Package org.flexdock.util
Class RootWindow
- java.lang.Object
-
- org.flexdock.util.RootWindow
-
public class RootWindow extends java.lang.Object
This class provides an abstraction of root containers used in Swing. It allows transparent use of methods common toJFrame
,JApplet
,JWindow
, andJDialog
without making an outward distinction between the different container types. This is accomplished by wrapping the root component.- Author:
- Chris Butler
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Integer
DEFAULT_MAXED_LAYER
-
Constructor Summary
Constructors Modifier Constructor Description protected
RootWindow(java.awt.Component root)
Creates a newRootSwingContainer
wrapping the specified component.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.awt.Rectangle
getBounds()
java.lang.Object
getClientProperty(java.lang.Object key)
java.awt.Container
getContentPane()
Returns thecontentPane
object for the wrapped component.java.awt.Component
getGlassPane()
Returns theglassPane
object for the wrapped component.javax.swing.JLayeredPane
getLayeredPane()
Returns thelayeredPane
object for the wrapped component.java.awt.Point
getLocationOnScreen()
Gets the location of the wrapped component in the form of a point specifying the component's top-left corner in the screen's coordinate space.java.lang.Integer
getMaximizationLayer()
Deprecated.dead code last used in 0.2.0java.awt.LayoutManager
getMaximizedLayout()
Deprecated.dead code last used in 0.2.0java.awt.Window[]
getOwnedWindows()
Return an array containing all the windows this window currently owns.java.awt.Window
getOwner()
java.awt.Component
getRootContainer()
Returns the the wrapped component.static RootWindow
getRootContainer(java.awt.Component c)
Traverses the container hierarchy to locate the root container and returns correspondingRootSwingContainer
.javax.swing.JRootPane
getRootPane()
Returns therootPane
object for the wrapped component.static RootWindow[]
getVisibleWindows()
boolean
isActive()
static boolean
isValidRootContainer(java.awt.Component c)
Indicates whether the suppliedComponent
is, in fact, a root Swing container.void
pack()
void
putClientProperty(java.lang.Object key, java.lang.Object value)
void
revalidateContentPane()
Convenience method that callsrevalidate()
on the current content pane if it is aJComponent
.void
setContentPane(java.awt.Container contentPane)
Sets thecontentPane
property for the wrapped component.void
setGlassPane(java.awt.Component glassPane)
Sets theglassPane
property for the wrapped component.void
setLayeredPane(javax.swing.JLayeredPane layeredPane)
Sets thelayeredPane
property for the wrapped component.void
setMaximizationLayer(java.lang.Integer layer)
Deprecated.dead code last used in 0.2.0void
setMaximizedLayout(java.awt.LayoutManager mgr)
Deprecated.dead code last used in 0.2.0protected void
setRootContainer(java.awt.Component root)
Sets the wrapped root container.void
toFront()
void
updateComponentTreeUI()
-
-
-
Method Detail
-
getRootContainer
public static RootWindow getRootContainer(java.awt.Component c)
Traverses the container hierarchy to locate the root container and returns correspondingRootSwingContainer
. Ifc
isnull
, anull
reference is returned.- Parameters:
c
- the container whose root we wish to find- Returns:
- the enclosing
RootSwingcontainer
-
isValidRootContainer
public static boolean isValidRootContainer(java.awt.Component c)
Indicates whether the suppliedComponent
is, in fact, a root Swing container.- Parameters:
c
- theComponent
we wish to check
-
getVisibleWindows
public static RootWindow[] getVisibleWindows()
-
getContentPane
public java.awt.Container getContentPane()
Returns thecontentPane
object for the wrapped component.- Returns:
- the
contentPane
property
-
getGlassPane
public java.awt.Component getGlassPane()
Returns theglassPane
object for the wrapped component.- Returns:
- the
glassPane
property
-
getLayeredPane
public javax.swing.JLayeredPane getLayeredPane()
Returns thelayeredPane
object for the wrapped component.- Returns:
- the
layeredPane
property
-
getLocationOnScreen
public java.awt.Point getLocationOnScreen()
Gets the location of the wrapped component in the form of a point specifying the component's top-left corner in the screen's coordinate space.- Returns:
- An instance of
Point
representing the top-left corner of the component's bounds in the coordinate space of the screen.
-
getMaximizationLayer
public java.lang.Integer getMaximizationLayer()
Deprecated.dead code last used in 0.2.0Returns the layer associated withComponent
maximization.- Returns:
- an
Integer
indicating the maximization layer property
-
getMaximizedLayout
public java.awt.LayoutManager getMaximizedLayout()
Deprecated.dead code last used in 0.2.0Returns theLayoutManager
associated withComponent
maximization within theRootSwingContainer
.- Returns:
- a
LayoutManager
indicating the maximization layout property
-
getRootContainer
public java.awt.Component getRootContainer()
Returns the the wrapped component. (JFrame
,JApplet
, etc...)- Returns:
- the wrapped root container
-
getRootPane
public javax.swing.JRootPane getRootPane()
Returns therootPane
object for the wrapped component.- Returns:
- the
rootPane
property
-
revalidateContentPane
public void revalidateContentPane()
Convenience method that callsrevalidate()
on the current content pane if it is aJComponent
. If not, no action is taken.
-
setContentPane
public void setContentPane(java.awt.Container contentPane)
Sets thecontentPane
property for the wrapped component.- Parameters:
contentPane
- thecontentPane
object for the wrapped component
-
setGlassPane
public void setGlassPane(java.awt.Component glassPane)
Sets theglassPane
property for the wrapped component.- Parameters:
glassPane
- theglassPane
object for the wrapped component
-
setLayeredPane
public void setLayeredPane(javax.swing.JLayeredPane layeredPane)
Sets thelayeredPane
property for the wrapped component.- Parameters:
layeredPane
- thelayeredPane
object for the wrapped component
-
getOwnedWindows
public java.awt.Window[] getOwnedWindows()
Return an array containing all the windows this window currently owns.- Returns:
- all the windows currently owned by this root window.
-
setMaximizationLayer
public void setMaximizationLayer(java.lang.Integer layer)
Deprecated.dead code last used in 0.2.0Sets the layer associated withComponent
maximization within theRootSwingContainer
. Iflayer
isnull
, DEFAULT_MAXED_LAYER is used instead.- Parameters:
layer
- anInteger
indicating the maximization layer property
-
setMaximizedLayout
public void setMaximizedLayout(java.awt.LayoutManager mgr)
Deprecated.dead code last used in 0.2.0Sets theLayoutManager
associated withComponent
maximization within theRootSwingContainer
.- Parameters:
mgr
- theLayoutManager
associated withComponent
maximization within theRootSwingContainer
.
-
setRootContainer
protected void setRootContainer(java.awt.Component root)
Sets the wrapped root container.- Parameters:
root
- the new wrapped root container
-
updateComponentTreeUI
public void updateComponentTreeUI()
-
pack
public void pack()
-
toFront
public void toFront()
-
isActive
public boolean isActive()
-
getOwner
public java.awt.Window getOwner()
-
getBounds
public java.awt.Rectangle getBounds()
-
putClientProperty
public void putClientProperty(java.lang.Object key, java.lang.Object value)
-
getClientProperty
public java.lang.Object getClientProperty(java.lang.Object key)
-
-