How do I create an applet window outside the web browser from within an applet running in that browser?
+1
A:
You can open a new window with AppletContext.showDocument()
. You'll need to have a page on the server with the HTML and all. You get the context from your applet, which inherits getAppletContext()
from the base class.
It'll end up looking something like this:
AppletContext ctxt = getAppletContext();
ctxt.showDocument("http://www.example.com/child_applet.html", "_top");
If you just want an external window, you can create and show a frame. It'll be a child of the applet and subject to the same restrictions. Also, it'll disappear if the user navigates away from the applet page.
JFrame frame = new JFrame();
// setup all the context...
frame.show();
sblundy
2008-12-12 14:39:08