Package org.flexdock.util
Class RootWindow
- java.lang.Object
-
- org.flexdock.util.RootWindow
-
public class RootWindow extends java.lang.ObjectThis class provides an abstraction of root containers used in Swing. It allows transparent use of methods common toJFrame,JApplet,JWindow, andJDialogwithout 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.IntegerDEFAULT_MAXED_LAYER
-
Constructor Summary
Constructors Modifier Constructor Description protectedRootWindow(java.awt.Component root)Creates a newRootSwingContainerwrapping the specified component.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.awt.RectanglegetBounds()java.lang.ObjectgetClientProperty(java.lang.Object key)java.awt.ContainergetContentPane()Returns thecontentPaneobject for the wrapped component.java.awt.ComponentgetGlassPane()Returns theglassPaneobject for the wrapped component.javax.swing.JLayeredPanegetLayeredPane()Returns thelayeredPaneobject for the wrapped component.java.awt.PointgetLocationOnScreen()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.IntegergetMaximizationLayer()Deprecated.dead code last used in 0.2.0java.awt.LayoutManagergetMaximizedLayout()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.WindowgetOwner()java.awt.ComponentgetRootContainer()Returns the the wrapped component.static RootWindowgetRootContainer(java.awt.Component c)Traverses the container hierarchy to locate the root container and returns correspondingRootSwingContainer.javax.swing.JRootPanegetRootPane()Returns therootPaneobject for the wrapped component.static RootWindow[]getVisibleWindows()booleanisActive()static booleanisValidRootContainer(java.awt.Component c)Indicates whether the suppliedComponentis, in fact, a root Swing container.voidpack()voidputClientProperty(java.lang.Object key, java.lang.Object value)voidrevalidateContentPane()Convenience method that callsrevalidate()on the current content pane if it is aJComponent.voidsetContentPane(java.awt.Container contentPane)Sets thecontentPaneproperty for the wrapped component.voidsetGlassPane(java.awt.Component glassPane)Sets theglassPaneproperty for the wrapped component.voidsetLayeredPane(javax.swing.JLayeredPane layeredPane)Sets thelayeredPaneproperty for the wrapped component.voidsetMaximizationLayer(java.lang.Integer layer)Deprecated.dead code last used in 0.2.0voidsetMaximizedLayout(java.awt.LayoutManager mgr)Deprecated.dead code last used in 0.2.0protected voidsetRootContainer(java.awt.Component root)Sets the wrapped root container.voidtoFront()voidupdateComponentTreeUI()
-
-
-
Method Detail
-
getRootContainer
public static RootWindow getRootContainer(java.awt.Component c)
Traverses the container hierarchy to locate the root container and returns correspondingRootSwingContainer. Ifcisnull, anullreference 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 suppliedComponentis, in fact, a root Swing container.- Parameters:
c- theComponentwe wish to check
-
getVisibleWindows
public static RootWindow[] getVisibleWindows()
-
getContentPane
public java.awt.Container getContentPane()
Returns thecontentPaneobject for the wrapped component.- Returns:
- the
contentPaneproperty
-
getGlassPane
public java.awt.Component getGlassPane()
Returns theglassPaneobject for the wrapped component.- Returns:
- the
glassPaneproperty
-
getLayeredPane
public javax.swing.JLayeredPane getLayeredPane()
Returns thelayeredPaneobject for the wrapped component.- Returns:
- the
layeredPaneproperty
-
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
Pointrepresenting 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 withComponentmaximization.- Returns:
- an
Integerindicating the maximization layer property
-
getMaximizedLayout
public java.awt.LayoutManager getMaximizedLayout()
Deprecated.dead code last used in 0.2.0Returns theLayoutManagerassociated withComponentmaximization within theRootSwingContainer.- Returns:
- a
LayoutManagerindicating 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 therootPaneobject for the wrapped component.- Returns:
- the
rootPaneproperty
-
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 thecontentPaneproperty for the wrapped component.- Parameters:
contentPane- thecontentPaneobject for the wrapped component
-
setGlassPane
public void setGlassPane(java.awt.Component glassPane)
Sets theglassPaneproperty for the wrapped component.- Parameters:
glassPane- theglassPaneobject for the wrapped component
-
setLayeredPane
public void setLayeredPane(javax.swing.JLayeredPane layeredPane)
Sets thelayeredPaneproperty for the wrapped component.- Parameters:
layeredPane- thelayeredPaneobject 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 withComponentmaximization within theRootSwingContainer. Iflayerisnull, DEFAULT_MAXED_LAYER is used instead.- Parameters:
layer- anIntegerindicating the maximization layer property
-
setMaximizedLayout
public void setMaximizedLayout(java.awt.LayoutManager mgr)
Deprecated.dead code last used in 0.2.0Sets theLayoutManagerassociated withComponentmaximization within theRootSwingContainer.- Parameters:
mgr- theLayoutManagerassociated withComponentmaximization 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)
-
-