Creating a child applet window from a parent applet

How can I create an applet window outside of a web browser from an applet running in that browser?

+1


source to share


1 answer


You can open a new window with AppletContext.showDocument()

. You need to have a page on the server with HTML and everything. You get the context from your applet, which inherits getAppletContext()

from the base class.

In the end, it looks something like this:

AppletContext ctxt = getAppletContext();
ctxt.showDocument("http://www.example.com/child_applet.html", "_top");

      



If you just need an outer window, you can create and display a frame. It will be a child of the applet and will obey the same restrictions. Also, it will disappear if the user navigates away from the applet page.

JFrame frame = new JFrame();
// setup all the context...
frame.show();

      

+1


source







All Articles