| public class javax.swing JApplet
|
Java SE 6 |
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 section
How to Make Applets.
The JApplet class is slightly incompatible with
java.applet.Applet. JApplet contains a
JRootPane as its only child. The contentPane
should be the parent of any children of the JApplet.
As a convenience add and its variants, remove and
setLayout have been overridden to forward to the
contentPane as necessary. This means you can write:
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 the
JApplet to throw an exception. The default
contentPane will have a BorderLayout
manager set on it.
Refer to javax.swing.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 JavaBeansTM
has been added to the java.beans package.
Please see java.beans.XMLEncoder.
| beaninfo | attribute: isContainer true attribute: containerDelegate getContentPane description: Swing's Applet subclass. |
| version | 1.71 08/08/06 |
| See also | javax.swing.RootPaneContainer |
| Fields | |||
|---|---|---|---|
| protected JRootPane | rootPane
| ||
| protected boolean | rootPaneCheckingEnabled If true then calls to add and setLayout
will be forwarded to the contentPane. This is initially
false, but is set to true when the JApplet is constructed.
| ||
| protected AccessibleContext | accessibleContext | ||
| Constructors | |||||
|---|---|---|---|---|---|
| public | JApplet() throws HeadlessException Creates a swing applet instance.
This constructor sets the component's locale property to the value
returned by
| ||||
| Methods | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| protected void | addImpl(Component comp, Object constraints, int index) Adds the specified child Component.
This method is overridden to conditionally forward calls to the
contentPane.
By default, children are added to the contentPane instead
of the frame, refer to javax.swing.RootPaneContainer for
details.
| ||||||||||||||
| protected JRootPane | createRootPane() Called by the constructor methods to create the default rootPane. | ||||||||||||||
| protected String | paramString() Returns a string representation of this JApplet. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.
| ||||||||||||||
| public void | remove(Component comp) Removes the specified component from the container. If comp is not the rootPane, this will forward
the call to the contentPane. This will do nothing if
comp is not a child of the JFrame or
contentPane.
| ||||||||||||||
| public void | repaint(long time, int x, int y, int width, int height) Repaints the specified rectangle of this component within time milliseconds. Refer to RepaintManager
for details on how the repaint is handled.
| ||||||||||||||
| public void | update(Graphics g) Just calls paint(g). This method was overridden to
prevent an unnecessary call to clear the background.
| ||||||||||||||
| Properties | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| public AccessibleContext | getAccessibleContext() Gets the AccessibleContext associated with this JApplet. For JApplets, the AccessibleContext takes the form of an AccessibleJApplet. A new AccessibleJApplet instance is created if necessary.
| ||||||||
| public void | setContentPane(Container contentPane) Sets the contentPane property. This method is called by the constructor.
| ||||||||
| public Container | getContentPane() Returns the contentPane object for this applet.
| ||||||||
| public void | setGlassPane(Component glassPane) Sets the glassPane property. This method is called by the constructor.
| ||||||||
| public Component | getGlassPane() Returns the glassPane object for this applet.
| ||||||||
| public Graphics | getGraphics() Creates a graphics context for this component. This method will return null if this component is currently not
displayable.
| ||||||||
| public void | setJMenuBar(JMenuBar menuBar) Sets the menubar for this applet.
| ||||||||
| public JMenuBar | getJMenuBar() Returns the menubar set on this applet.
| ||||||||
| public void | setLayeredPane(JLayeredPane layeredPane) Sets the layeredPane property. This method is called by the constructor.
| ||||||||
| public JLayeredPane | getLayeredPane() Returns the layeredPane object for this applet.
| ||||||||
| public void | setLayout(LayoutManager manager) Sets the LayoutManager.
Overridden to conditionally forward the call to the
contentPane.
Refer to javax.swing.RootPaneContainer for
more information.
| ||||||||
| protected void | setRootPane(JRootPane root) Sets the rootPane property. This method is called by the constructor.
| ||||||||
| public JRootPane | getRootPane() Returns the rootPane object for this applet.
| ||||||||
| protected void | setRootPaneCheckingEnabled(boolean enabled) Sets whether calls to add and
setLayout are forwarded to the contentPane.
| ||||||||
| protected boolean | isRootPaneCheckingEnabled() Returns whether calls to add and
setLayout are forwarded to the contentPane.
| ||||||||
| public void | setTransferHandler(TransferHandler newHandler) Sets the transferHandler property, which is a mechanism to
support transfer of data into this component. Use null
if the component does not support data transfer operations.
If the system property
Note: When used with Please see How to Use Drag and Drop and Data Transfer, a section in The Java Tutorial, for more information.
| ||||||||
| public TransferHandler | getTransferHandler() Gets the transferHandler property.
| ||||||||
| About DocWeb · Bundles · Export · Export All | Top 10 · Statistics · Login |
| About Sun · Contact · Privacy · Terms of Use · Trademarks | Java SE 6 · Copyright © 1994-2009 Sun Microsystems, Inc.All rights reserved. Use is subject to license terms |
![]() |
![]() |
|