open new window using java - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

open new window using java

zhi_yizhi_yi Posts: 28Member
hi, please help me, does anybody know how to open a new window using java?

the program that i would like to make would be like this, there are three text boxes with three command buttons.

while the program is running, i can type the link into these three text boxes, for example, in textbox1 i type: www.programmersheaven.com, in the second textbox i type: www.yahoo.com, and in the third one i type: www.google.com, while i press the first button, the program would open a new window, and go to the link "www.programmersheaven.com", and if i press the second command button, it would go to www.yahoo.com in a new window..

Thank you for your time on reading my question and answer it, i am waiting for your reply..

Best Regards,
Zhi Yi

Comments

  • zibadianzibadian Posts: 6,349Member
    : hi, please help me, does anybody know how to open a new window using java?
    :
    : the program that i would like to make would be like this, there are three text boxes with three command buttons.
    :
    : while the program is running, i can type the link into these three text boxes, for example, in textbox1 i type: www.programmersheaven.com, in the second textbox i type: www.yahoo.com, and in the third one i type: www.google.com, while i press the first button, the program would open a new window, and go to the link "www.programmersheaven.com", and if i press the second command button, it would go to www.yahoo.com in a new window..
    :
    : Thank you for your time on reading my question and answer it, i am waiting for your reply..
    :
    : Best Regards,
    : Zhi Yi
    :
    If you want to open a new window from an applet, you can use the ApplectContext.showDocument() method (http://java.sun.com/j2se/1.5.0/docs/api/java/applet/AppletContext.html).
    If you want to open a browser from an application, see this reference: http://www.javaworld.com/javaworld/javatips/jw-javatip66.html
    If you want to open a new Java window in your application, you should use JFrame, since Swing components can handle html natively. I don't know if that includes images or if there is a class which can mimic a browser window.
  • zhi_yizhi_yi Posts: 28Member
    : : hi, please help me, does anybody know how to open a new window using java?
    : :
    : : the program that i would like to make would be like this, there are three text boxes with three command buttons.
    : :
    : : while the program is running, i can type the link into these three text boxes, for example, in textbox1 i type: www.programmersheaven.com, in the second textbox i type: www.yahoo.com, and in the third one i type: www.google.com, while i press the first button, the program would open a new window, and go to the link "www.programmersheaven.com", and if i press the second command button, it would go to www.yahoo.com in a new window..
    : :
    : : Thank you for your time on reading my question and answer it, i am waiting for your reply..
    : :
    : : Best Regards,
    : : Zhi Yi
    : :
    : If you want to open a new window from an applet, you can use the ApplectContext.showDocument() method (http://java.sun.com/j2se/1.5.0/docs/api/java/applet/AppletContext.html).
    : If you want to open a browser from an application, see this reference: http://www.javaworld.com/javaworld/javatips/jw-javatip66.html
    : If you want to open a new Java window in your application, you should use JFrame, since Swing components can handle html natively. I don't know if that includes images or if there is a class which can mimic a browser window.
    :


    Thank You Zibadian..
    Now, let say that I have open a new web page, for example www.yahoo.com, now, if I want to send data (username and password) to the textbox in the web page, how to program it in java?

    So, when we run the program, there are two blank textboxes in our program, one is for username, and another one is for the password, and a command button. First, the user would would fill the username and password, and when the user press the command button, the program would open www.yahoo.com, and send the username and password from the program to the web page.. Thank You.

    Best Regards,
    Zhi Yi
  • zibadianzibadian Posts: 6,349Member
    [b][red]This message was edited by zibadian at 2007-4-24 23:41:10[/red][/b][hr]
    : : : hi, please help me, does anybody know how to open a new window using java?
    : : :
    : : : the program that i would like to make would be like this, there are three text boxes with three command buttons.
    : : :
    : : : while the program is running, i can type the link into these three text boxes, for example, in textbox1 i type: www.programmersheaven.com, in the second textbox i type: www.yahoo.com, and in the third one i type: www.google.com, while i press the first button, the program would open a new window, and go to the link "www.programmersheaven.com", and if i press the second command button, it would go to www.yahoo.com in a new window..
    : : :
    : : : Thank you for your time on reading my question and answer it, i am waiting for your reply..
    : : :
    : : : Best Regards,
    : : : Zhi Yi
    : : :
    : : If you want to open a new window from an applet, you can use the ApplectContext.showDocument() method (http://java.sun.com/j2se/1.5.0/docs/api/java/applet/AppletContext.html).
    : : If you want to open a browser from an application, see this reference: http://www.javaworld.com/javaworld/javatips/jw-javatip66.html
    : : If you want to open a new Java window in your application, you should use JFrame, since Swing components can handle html natively. I don't know if that includes images or if there is a class which can mimic a browser window.
    : :
    :
    :
    : Thank You Zibadian..
    : Now, let say that I have open a new web page, for example www.yahoo.com, now, if I want to send data (username and password) to the textbox in the web page, how to program it in java?
    :
    : So, when we run the program, there are two blank textboxes in our program, one is for username, and another one is for the password, and a command button. First, the user would would fill the username and password, and when the user press the command button, the program would open www.yahoo.com, and send the username and password from the program to the web page.. Thank You.
    :
    : Best Regards,
    : Zhi Yi
    :
    If your window is part of your application and the component which shows the page allows you access to the HTML DOM, you can use HTML DOM with the names of the fields to set them in a similar fashion as Javascript or VB.
    With an applet this is not possible I think, unless you grant the appropriate rights to the applet. If you've granted those rights you can use the method of the application.
    If the window isn't part of the application, you might be able to simulate keypresses from your application to the focused window. I don't know how to code this in Java, but perhaps you can find that code on the web.
    An alternative is not to open a new window with the login page, but find out what happens when the user presses the "submit"-button. Once you know that, you can directly submit the password and username from your program and open a new window with the submitted information. This bypasses the need to place values in the webform.
Sign In or Register to comment.