JApplet (Java Platform SE 8 ) (original) (raw)
An extended version of java.applet.Applet
that adds support for the JFC/Swing component architecture. You can find task-oriented documentation about using JApplet
in The Java Tutorial, in the sectionHow to Make Applets.
The JApplet
class is slightly incompatible withjava.applet.Applet
. JApplet
contains aJRootPane
as its only child. The contentPane
should be the parent of any children of the JApplet
. As a convenience, the add
, remove
, and setLayout
methods of this class are overridden, so that they delegate calls to the corresponding methods of the ContentPane
. For example, you can add a child component to an applet as follows:
applet.add(child);
And the child will be added to the contentPane
. The contentPane
will always be non-null
. Attempting to set it to null
will cause theJApplet
to throw an exception. The defaultcontentPane
will have a BorderLayout
manager set on it. Refer to RootPaneContainer for details on adding, removing and setting the LayoutManager
of a JApplet
.
Please see the JRootPane
documentation for a complete description of the contentPane
, glassPane
, and layeredPane
properties.
Warning: Swing is not thread safe. For more information see Swing's Threading Policy.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans
package. Please see XMLEncoder.