Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes New Browser Window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "New Browser Window" Watch "New Browser Window" New topic
Author

New Browser Window

Angela Jessi
Ranch Hand

Joined: Nov 27, 2000
Posts: 428
Hi,
Is there any method in Applet or in java, when I click Button or do some events, it should open new Browser window?

Thanks
Angela
Michael Bruesch
Ranch Hand

Joined: Sep 23, 2001
Posts: 158
I haven't tried this yet, but if you look in the applet class, there's a method called getAppletContext () which determines the applet's context, which allows the applet to query and affect the environment in which it runs, and returns an object of type AppletContext. If you look in class AppletContext, there's a method called showDocument (URL url, String target) which may be what you're looking for. Here's what it says in the API about it:

public void showDocument(URL url,
String target)
Requests that the browser or applet viewer show the Web page indicated by the url argument. The target argument indicates in which HTML frame the document is to be displayed. The target argument is interpreted as follows:
"_self" Show in the window and frame that contain the applet.
"_parent" Show in the applet's parent frame. If the applet's frame has no parent frame, acts the same as "_self".
"_top" Show in the top-level frame of the applet's window. If the applet's frame is the top-level frame, acts the same as "_self".
"_blank" Show in a new, unnamed top-level window.
name Show in the frame or window named name. If a target named name does not already exist, a new top-level window with the specified name is created, and the document is shown there.
An applet viewer or browser is free to ignore showDocument.
Parameters:
url - an absolute URL giving the location of the document.
target - a String indicating where to display the page.

You may want to root throught this class yourself, this may not be exactly what you need, but it sounds like it.

------------------
Michael J Bruesch
Codito, ergo sum...
I code, therefore I am.
My Java Games, I'm quite proud


Michael J Bruesch<br /><i>I code, therefore I am.</i>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: New Browser Window