Constructors 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 JComponent.getDefaultLocale .
this((Frame)null);
|
public JWindow(GraphicsConfiguration gc)Creates a window with the specified 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 .
this(null, gc);
super.setFocusableWindowState(false);
|
public JWindow(Frame owner)Creates a window with the specified owner frame.
If 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 .
super(owner == null? SwingUtilities.getSharedOwnerFrame() : owner);
if (owner == null) {
WindowListener ownerShutdownListener =
(WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
addWindowListener(ownerShutdownListener);
}
windowInit();
|
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 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 .
super(owner == null ? (Window)SwingUtilities.getSharedOwnerFrame() :
owner);
if (owner == null) {
WindowListener ownerShutdownListener =
(WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
addWindowListener(ownerShutdownListener);
}
windowInit();
|
public JWindow(Window owner, GraphicsConfiguration gc)Creates a window with the specified owner window and
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 .
super(owner == null ? (Window)SwingUtilities.getSharedOwnerFrame() :
owner, gc);
if (owner == null) {
WindowListener ownerShutdownListener =
(WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
addWindowListener(ownerShutdownListener);
}
windowInit();
|
Methods Summary |
---|
protected void | addImpl(java.awt.Component comp, java.lang.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 {@link javax.swing.RootPaneContainer} for
details.
if(isRootPaneCheckingEnabled()) {
getContentPane().add(comp, constraints, index);
}
else {
super.addImpl(comp, constraints, index);
}
|
protected javax.swing.JRootPane | createRootPane()Called by the constructor methods to create the default
rootPane .
JRootPane rp = new JRootPane();
// NOTE: this uses setOpaque vs LookAndFeel.installProperty as there
// is NO reason for the RootPane not to be opaque. For painting to
// work the contentPane must be opaque, therefor the RootPane can
// also be opaque.
rp.setOpaque(true);
return rp;
|
public javax.accessibility.AccessibleContext | getAccessibleContext()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.
if (accessibleContext == null) {
accessibleContext = new AccessibleJWindow();
}
return accessibleContext;
|
public java.awt.Container | getContentPane()Returns the Container which is the contentPane
for this window.
return getRootPane().getContentPane();
|
public java.awt.Component | getGlassPane()Returns the glassPane Component for this window.
return getRootPane().getGlassPane();
|
public java.awt.Graphics | getGraphics(){@inheritDoc}
JComponent.getGraphicsInvoked(this);
return super.getGraphics();
|
public javax.swing.JLayeredPane | getLayeredPane()Returns the layeredPane object for this window.
return getRootPane().getLayeredPane();
|
public javax.swing.JRootPane | getRootPane()Returns the rootPane object for this window.
return rootPane;
|
public javax.swing.TransferHandler | getTransferHandler()Gets the transferHandler property.
return transferHandler;
|
protected boolean | isRootPaneCheckingEnabled()Returns whether calls to add and
setLayout are forwarded to the contentPane .
return rootPaneCheckingEnabled;
|
protected java.lang.String | paramString()Returns a string representation of this 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 .
String rootPaneCheckingEnabledString = (rootPaneCheckingEnabled ?
"true" : "false");
return super.paramString() +
",rootPaneCheckingEnabled=" + rootPaneCheckingEnabledString;
|
public void | remove(java.awt.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 JWindow or
contentPane .
if (comp == rootPane) {
super.remove(comp);
} else {
getContentPane().remove(comp);
}
|
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.
if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
RepaintManager.currentManager(this).addDirtyRegion(
this, x, y, width, height);
}
else {
super.repaint(time, x, y, width, height);
}
|
public void | setContentPane(java.awt.Container contentPane)Sets the contentPane property for this window.
This method is called by the constructor.
getRootPane().setContentPane(contentPane);
|
public void | setGlassPane(java.awt.Component glassPane)Sets the glassPane property.
This method is called by the constructor.
getRootPane().setGlassPane(glassPane);
|
public void | setLayeredPane(javax.swing.JLayeredPane layeredPane)Sets the layeredPane property.
This method is called by the constructor.
getRootPane().setLayeredPane(layeredPane);
|
public void | setLayout(java.awt.LayoutManager manager)Sets the LayoutManager .
Overridden to conditionally forward the call to the
contentPane .
Refer to {@link javax.swing.RootPaneContainer} for
more information.
if(isRootPaneCheckingEnabled()) {
getContentPane().setLayout(manager);
}
else {
super.setLayout(manager);
}
|
protected void | setRootPane(javax.swing.JRootPane root)Sets the new rootPane object for this window.
This method is called by the constructor.
if(rootPane != null) {
remove(rootPane);
}
rootPane = root;
if(rootPane != null) {
boolean checkingEnabled = isRootPaneCheckingEnabled();
try {
setRootPaneCheckingEnabled(false);
add(rootPane, BorderLayout.CENTER);
}
finally {
setRootPaneCheckingEnabled(checkingEnabled);
}
}
|
protected void | setRootPaneCheckingEnabled(boolean enabled)Sets whether calls to add and
setLayout are forwarded to the contentPane .
rootPaneCheckingEnabled = enabled;
|
public void | setTransferHandler(javax.swing.TransferHandler newHandler)Sets the {@code transferHandler} property, which is a mechanism to
support transfer of data into this component. Use {@code null}
if the component does not support data transfer operations.
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.
TransferHandler oldHandler = transferHandler;
transferHandler = newHandler;
SwingUtilities.installSwingDropTargetAsNecessary(this, transferHandler);
firePropertyChange("transferHandler", oldHandler, newHandler);
|
public void | update(java.awt.Graphics g)Calls paint(g) . This method was overridden to
prevent an unnecessary call to clear the background.
paint(g);
|
protected void | windowInit()Called by the constructors to init the JWindow properly.
setLocale( JComponent.getDefaultLocale() );
setRootPane(createRootPane());
setRootPaneCheckingEnabled(true);
sun.awt.SunToolkit.checkAndSetPolicy(this, true);
|