Java

Moderators: zibadian
Number of threads: 7818
Number of posts: 18218

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
open new window using java Posted by zhi_yi on 24 Apr 2007 at 1:32 AM
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
Report
Re: open new window using java Posted by zibadian on 24 Apr 2007 at 3:20 AM
: 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.
Report
Re: open new window using java Posted by zhi_yi on 24 Apr 2007 at 10:58 PM
: : 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
Report
Re: open new window using java Posted by zibadian on 24 Apr 2007 at 11:40 PM
This message was edited by zibadian at 2007-4-24 23:41:10

: : : 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.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.