| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public class JWindow extends Window implements Accessible, RootPaneContainer, TransferHandler.HasGetTransferHandler
A 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 conveniance add
and its variants, remove
and
setLayout
have been overridden to forward to the
contentPane
as necessary. This means you can write:
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 {@link javax.swing.RootPaneContainer}
for details on adding, removing and setting the LayoutManager
of a JWindow
.
Please see the {@link 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 {@link java.awt.Window} 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 JavaBeansTM
has been added to the java.beans
package.
Please see {@link java.beans.XMLEncoder}.
Nested Class Summary | |
---|---|
protected class |
This class implements accessibility support for the JWindow class. |
Nested classes/interfaces inherited from class java.awt.Window |
---|
Window.AccessibleAWTWindow |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected AccessibleContext |
accessibleContext
The accessible context property. |
protected JRootPane |
rootPane
The JRootPane instance that manages the
contentPane
and optional menuBar for this frame, as well as the
glassPane . |
protected boolean |
rootPaneCheckingEnabled
If true then calls to add and setLayout
will be forwarded to the contentPane . |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Constructor Summary | |
---|---|
JWindow() Creates a window with no specified owner. |
|
Creates a window with the specified owner frame. |
|
Creates a window with the specified GraphicsConfiguration
of a screen device.
|
|
Creates a window with the specified owner window. |
|
JWindow(Window owner, GraphicsConfiguration gc) Creates a window with the specified owner window and GraphicsConfiguration of a screen device.
|
Method Summary | |
---|---|
protected void |
Adds the specified child Component .
|
protected JRootPane |
Called by the constructor methods to create the default rootPane .
|
AccessibleContext |
Gets the AccessibleContext associated with this JWindow. |
Container |
Returns the Container which is the contentPane
for this window.
|
Component |
Returns the glassPane Component for this window.
|
Graphics |
Creates a graphics context for this component. |
JLayeredPane |
Returns the layeredPane object for this window.
|
JRootPane |
Returns the rootPane object for this window.
|
TransferHandler |
Gets the transferHandler property.
|
protected boolean |
Returns whether calls to add and
setLayout are forwarded to the contentPane .
|
protected String |
Returns a string representation of this JWindow .
|
void |
Removes the specified component from the container. |
void |
repaint(long time, int x, int y, int width, int height) Repaints the specified rectangle of this component within time milliseconds.
|
void |
setContentPane(Container contentPane) Sets the contentPane property for this window.
|
void |
setGlassPane(Component glassPane) Sets the glassPane property.
|
void |
setLayeredPane(JLayeredPane layeredPane) Sets the layeredPane property.
|
void |
setLayout(LayoutManager manager) Sets the LayoutManager .
|
protected void |
setRootPane(JRootPane root) Sets the new rootPane object for this window.
|
protected void |
setRootPaneCheckingEnabled(boolean enabled) Sets whether calls to add and
setLayout are forwarded to the contentPane .
|
void |
setTransferHandler(TransferHandler newHandler) Sets the property, which is a mechanism to support transfer of data into this component. |
void |
Calls paint(g) .
|
protected void |
Called by the constructors to init the JWindow properly.
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected AccessibleContext accessibleContext
protected JRootPane rootPane
JRootPane
instance that manages the
contentPane
and optional menuBar
for this frame, as well as the
glassPane
.
protected boolean rootPaneCheckingEnabled
add
and setLayout
will be forwarded to the contentPane
. This is initially
false, but is set to true when the JWindow
is constructed.
Constructor Detail |
---|
public JWindow()
This constructor sets the component's locale property to the value
returned by JComponent.getDefaultLocale
.
public JWindow(Frame owner)
owner
is null
, the shared owner
will be used and this window will not be focusable. Also,
this window will not be focusable unless its owner is showing
on the screen.
This constructor sets the component's locale property to the value
returned by JComponent.getDefaultLocale
.
owner
- the frame from which the window is displayedpublic JWindow(GraphicsConfiguration gc)
GraphicsConfiguration
of a screen device. This window will not be focusable.
This constructor sets the component's locale property to the value
returned by JComponent.getDefaultLocale
.
gc
- the GraphicsConfiguration
that is used
to construct the new window with; if gc is null
,
the system default GraphicsConfiguration
is assumedpublic JWindow(Window owner)
owner
is null
, the shared owner
will be used and this window will not be focusable.
This constructor sets the component's locale property to the value
returned by JComponent.getDefaultLocale
.
owner
- the window from which the window is displayedpublic JWindow(Window owner, GraphicsConfiguration gc)
GraphicsConfiguration
of a screen device. If
owner
is null
, the shared owner will be used
and this window will not be focusable.
This constructor sets the component's locale property to the value
returned by JComponent.getDefaultLocale
.
owner
- the window from which the window is displayedgc
- the 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.Method Detail |
---|
protected void addImpl(Component comp, Object constraints, int index)
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 {@link javax.swing.RootPaneContainer} for
details.
addImpl
in class Container
comp
- the component to be enhancedconstraints
- the constraints to be respectedindex
- the indexprotected JRootPane createRootPane()
rootPane
.
public AccessibleContext getAccessibleContext()
getAccessibleContext
in class Window
public Container getContentPane()
Container
which is the contentPane
for this window.
contentPane
propertypublic Component getGlassPane()
glassPane Component
for this window.
glassPane
propertypublic Graphics getGraphics()
getGraphics
in class Component
public JLayeredPane getLayeredPane()
layeredPane
object for this window.
layeredPane
propertypublic JRootPane getRootPane()
rootPane
object for this window.
rootPane
property for this windowpublic TransferHandler getTransferHandler()
transferHandler
property.
transferHandler
propertyprotected boolean isRootPaneCheckingEnabled()
add
and
setLayout
are forwarded to the contentPane
.
add
and setLayout
are fowarded; false otherwiseprotected String paramString()
JWindow
.
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
.
paramString
in class Container
JWindow
public void remove(Component comp)
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 JWindow
or
contentPane
.
remove
in class Container
comp
- the component to be removedpublic void repaint(long time, int x, int y, int width, int height)
time
milliseconds. Refer to RepaintManager
for details on how the repaint is handled.
repaint
in class Component
time
- maximum time in milliseconds before updatex
- the x coordinatey
- the y coordinatewidth
- the widthheight
- the heightpublic void setContentPane(Container contentPane)
contentPane
property for this window.
This method is called by the constructor.
contentPane
- the new contentPane
public void setGlassPane(Component glassPane)
glassPane
property.
This method is called by the constructor.
glassPane
- the glassPane
object for this windowpublic void setLayeredPane(JLayeredPane layeredPane)
layeredPane
property.
This method is called by the constructor.
layeredPane
- the new layeredPane
objectpublic void setLayout(LayoutManager manager)
LayoutManager
.
Overridden to conditionally forward the call to the
contentPane
.
Refer to {@link javax.swing.RootPaneContainer} for
more information.
setLayout
in class Container
manager
- the LayoutManager
protected void setRootPane(JRootPane root)
rootPane
object for this window.
This method is called by the constructor.
root
- the new rootPane
propertyprotected void setRootPaneCheckingEnabled(boolean enabled)
add
and
setLayout
are forwarded to the contentPane
.
enabled
- true if add
and setLayout
are forwarded, false if they should operate directly on the
JWindow
.public void setTransferHandler(TransferHandler newHandler)
If the system property {@code suppressSwingDropSupport} is {@code false} (the default) and the current drop target on this component is either {@code null} or not a user-set drop target, this method will change the drop target as follows: If {@code newHandler} is {@code null} it will clear the drop target. If not {@code null} it will install a new {@code DropTarget}.
Note: When used with {@code JWindow}, {@code TransferHandler} only provides data import capability, as the data export related methods are currently typed to {@code JComponent}.
Please see How to Use Drag and Drop and Data Transfer, a section in The Java Tutorial, for more information.
newHandler
- the new {@code TransferHandler}public void update(Graphics g)
paint(g)
. This method was overridden to
prevent an unnecessary call to clear the background.
update
in class Container
g
- the Graphics
context in which to paintprotected void windowInit()
JWindow
properly.
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |