JWindow is a container that can be displayed anywhere on the
user's desktop. It does not have the title bar, window-management buttons,
or other trimmings associated with a JFrame, but it is still a
"first-class citizen" of the user's desktop, and can exist anywhere
on it.
The JWindow component contains a JRootPane
as its only child. The contentPane should be the parent
of any children of the JWindow.
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 a window as follows:
window.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 JWindow
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 JWindow.
Please see the JRootPane documentation for a complete description of
the contentPane, glassPane, and
layeredPane components.
In a multi-screen environment, you can create a JWindow
on a different screen device. See java. for more
information.
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 java..
JRootPane
| Modifier and Type | Class and Description |
|---|---|
| protected class | JWindow.
This class implements accessibility support for the
|
| Modifier and Type | Field and Description |
|---|---|
| protected AccessibleContext | accessibleContext
The accessible context property.
|
| protected JRootPane | rootPane
The |
| protected boolean | rootPaneCheckingEnabled
If true then calls to |
| private TransferHandler | transferHandler
The |
| Access | Constructor and Description |
|---|---|
| public | |
| public | JWindow(GraphicsConfiguration
the gc)GraphicsConfiguration that is used
to construct the new window with; if gc is null,
the system default GraphicsConfiguration
is assumedCreates a window with the specified |
| public | |
| public | |
| public | JWindow(Window
the window from which the window is displayed owner, GraphicsConfiguration the gc)GraphicsConfiguration that is used
to construct the new window with; if gc is null,
the system default GraphicsConfiguration
is assumed, unless owner is also null, in which
case the GraphicsConfiguration from the
shared owner frame will be used.Creates a window with the specified owner window and
|
| Modifier and Type | Method and Description |
|---|---|
| protected void | addImpl(Component
the component to be enhanced comp, Object the constraints to be respected constraints, int the index index)Overrides java. Adds the specified child |
| protected JRootPane | Returns: a newJRootPaneCalled by the constructor methods to create the default
|
| public AccessibleContext | Returns: an AccessibleJWindow that serves as the AccessibleContext of this JWindowOverrides java. Implements javax. Gets the AccessibleContext associated with this JWindow. |
| public Container | Returns: thecontentPane propertyImplements javax. Returns the |
| public Component | Returns: theglassPane propertyImplements javax. Returns the |
| public Graphics | getGraphics()
Overrides java. Creates a graphics context for this component. |
| public JLayeredPane | Returns: thelayeredPane propertyImplements javax. Returns the |
| public JRootPane | Returns: therootPane property for this windowImplements javax. Returns the |
| public TransferHandler | Returns: the value of thetransferHandler propertyImplements javax. Gets the |
| protected boolean | Returns: true ifadd and setLayout
are forwarded; false otherwiseReturns whether calls to |
| protected String | Returns: a string representation of thisJWindowOverrides java. Returns a string representation of this |
| public void | remove(Component
the component to be removed comp)Overrides java. Removes the specified component from the container. |
| public void | repaint(long
maximum time in milliseconds before update time, int the x coordinate x, int the y coordinate y, int the width width, int the height height)Overrides java. Repaints the specified rectangle of this component within
|
| public void | setContentPane(Container
the new contentPane)contentPaneImplements javax. Sets the |
| public void | setGlassPane(Component
the glassPane)glassPane object for this windowImplements javax. Sets the |
| public void | setLayeredPane(JLayeredPane
the new layeredPane)layeredPane objectImplements javax. Sets the |
| public void | setLayout(LayoutManager
the manager)LayoutManagerOverrides java. Sets the |
| protected void | |
| protected void | setRootPaneCheckingEnabled(boolean
true if enabled)add and setLayout
are forwarded, false if they should operate directly on the
JWindow.Sets whether calls to |
| public void | setTransferHandler(TransferHandler
the new newHandler)TransferHandlerSets the |
| public void | update(Graphics
the g)Graphics context in which to paintOverrides java. Calls |
| protected void |
| accessibleContext | back to summary |
|---|---|
| protected AccessibleContext accessibleContext Hides java. The accessible context property. | |
| rootPane | back to summary |
|---|---|
| protected JRootPane rootPane The
| |
| rootPaneCheckingEnabled | back to summary |
|---|---|
| protected boolean rootPaneCheckingEnabled If true then calls to | |
| transferHandler | back to summary |
|---|---|
| private TransferHandler transferHandler The | |
| JWindow | back to summary |
|---|---|
| public JWindow() Creates a window with no specified owner. This window will not be focusable.
This constructor sets the component's locale property to the value
returned by
| |
| JWindow | back to summary |
|---|---|
| public JWindow(GraphicsConfiguration gc) Creates a window with the specified
This constructor sets the component's locale property to the value
returned by
| |
| JWindow | back to summary |
|---|---|
| public JWindow(Frame owner) Creates a window with the specified owner frame.
If
This constructor sets the component's locale property to the value
returned by
| |
| JWindow | back to summary |
|---|---|
| public JWindow(Window owner) Creates a window with the specified owner window. This window
will not be focusable unless its owner is showing on the screen.
If
This constructor sets the component's locale property to the value
returned by
| |
| JWindow | back to summary |
|---|---|
| public JWindow(Window owner, GraphicsConfiguration gc) Creates a window with the specified owner window and
This constructor sets the component's locale property to the value
returned by
| |
| addImpl | back to summary |
|---|---|
| protected void addImpl(Component comp, Object constraints, int index) Overrides java. Adds the specified child
| |
| createRootPane | back to summary |
|---|---|
| protected JRootPane createRootPane() Called by the constructor methods to create the default
| |
| getAccessibleContext | back to summary |
|---|---|
| public AccessibleContext getAccessibleContext() Overrides java. Implements javax. Gets the AccessibleContext associated with this JWindow. For JWindows, the AccessibleContext takes the form of an AccessibleJWindow. A new AccessibleJWindow instance is created if necessary.
| |
| getContentPane | back to summary |
|---|---|
| public Container getContentPane() Implements javax. Returns the
| |
| getGlassPane | back to summary |
|---|---|
| public Component getGlassPane() Implements javax. Returns the
| |
| getGraphics | back to summary |
|---|---|
| public Graphics getGraphics() Overrides java. Doc from java. Creates a graphics context for this component. This method will
return
| |
| getLayeredPane | back to summary |
|---|---|
| public JLayeredPane getLayeredPane() Implements javax. Returns the
| |
| getRootPane | back to summary |
|---|---|
| public JRootPane getRootPane() Implements javax. Returns the
| |
| getTransferHandler | back to summary |
|---|---|
| public TransferHandler getTransferHandler() Implements javax. Gets the
| |
| isRootPaneCheckingEnabled | back to summary |
|---|---|
| protected boolean isRootPaneCheckingEnabled() Returns whether calls to
| |
| paramString | back to summary |
|---|---|
| protected String paramString() Overrides java. Returns a string representation of this
| |
| remove | back to summary |
|---|---|
| public void remove(Component comp) Overrides java. Removes the specified component from the container. If
| |
| repaint | back to summary |
|---|---|
| public void repaint(long time, int x, int y, int width, int height) Overrides java. Repaints the specified rectangle of this component within
| |
| setContentPane | back to summary |
|---|---|
| public void setContentPane(Container contentPane) Implements javax. Sets the
| |
| setGlassPane | back to summary |
|---|---|
| public void setGlassPane(Component glassPane) Implements javax. Sets the
| |
| setLayeredPane | back to summary |
|---|---|
| public void setLayeredPane(JLayeredPane layeredPane) Implements javax. Sets the
| |
| setLayout | back to summary |
|---|---|
| public void setLayout(LayoutManager manager) Overrides java. Sets the
| |
| setRootPane | back to summary |
|---|---|
| protected void setRootPane(JRootPane root) Sets the new
| |
| setRootPaneCheckingEnabled | back to summary |
|---|---|
| protected void setRootPaneCheckingEnabled(boolean enabled) Sets whether calls to
| |
| setTransferHandler | back to summary |
|---|---|
| public void setTransferHandler(TransferHandler newHandler) Sets the
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.
| |
| update | back to summary |
|---|---|
| public void update(Graphics g) Overrides java. Calls
| |
| windowInit | back to summary |
|---|---|
| protected void windowInit() Called by the constructors to init the | |
JWindow class. It provides an implementation of the
Java Accessibility API appropriate to window user-interface
elements.
| Access | Constructor and Description |
|---|---|
| protected |
| AccessibleJWindow | back to summary |
|---|---|
| protected AccessibleJWindow() Constructs an | |