File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes opening  new browser window from applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "opening  new browser window from applet" Watch "opening  new browser window from applet" New topic

opening new browser window from applet

Donny Frank-Rice

Joined: Dec 30, 2003
Posts: 14
I am working on an applet that contains an Internet usage policy for our library patrons to view and "accept" (by clicking on the acceptance button). I have the applet working so that when a patron chooses to browse the Internet from our menu the applet appears. When the patron clicks on the acceptance button, the browser loads Google in the same page. That works for us. Is it possible to have the applet launch in a browser window that does not have an address bar or navigation buttons? If so, I would need help with rewriting the actionPerformed method so that when the patron clicks on the acceptance button that window closes and a new browser window opens.
I hope I am being clear enough. Any help would be greatly appreciated. Thanks in advance. Here is my actionPerformed method:
//This method opens Google when the acceptance button is clicked
public void actionPerformed(ActionEvent evt)
if (evt.getSource() == jbtAgree)
AppletContext context = getAppletContext();
URL url = new URL("");
catch(MalformedURLException ex)
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

There's a two-argument form of "showDocument()" which takes a frame name in addition to the URL; the document is shown in that frame. If you use a non-existent name, a new window is created. Otherwise, I think there's a special name you can use ("__new" ?) which always opens a new frame, although I forget the specifics; maybe someone else remembers.
As this is not an advanced question, I'm moving this to "Applets" for further follow-ups.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: opening new browser window from applet
It's not a secret anymore!