Package org.flexdock.util
Class RootWindow
java.lang.Object
org.flexdock.util.RootWindow
This class provides an abstraction of root containers used in Swing. It
allows transparent use of methods common to
JFrame, JApplet,
JWindow, and JDialog without making an outward distinction
between the different container types. This is accomplished by wrapping the
root component.- Author:
- Chris Butler
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRootWindow(Component root) Creates a newRootSwingContainerwrapping the specified component. -
Method Summary
Modifier and TypeMethodDescriptiongetClientProperty(Object key) Returns thecontentPaneobject for the wrapped component.Returns theglassPaneobject for the wrapped component.Returns thelayeredPaneobject for the wrapped component.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.Deprecated.dead code last used in 0.2.0Deprecated.dead code last used in 0.2.0Window[]Return an array containing all the windows this window currently owns.getOwner()Returns the the wrapped component.static RootWindowTraverses the container hierarchy to locate the root container and returns correspondingRootSwingContainer.Returns therootPaneobject for the wrapped component.static RootWindow[]booleanisActive()static booleanIndicates whether the suppliedComponentis, in fact, a root Swing container.voidpack()voidputClientProperty(Object key, Object value) voidConvenience method that callsrevalidate()on the current content pane if it is aJComponent.voidsetContentPane(Container contentPane) Sets thecontentPaneproperty for the wrapped component.voidsetGlassPane(Component glassPane) Sets theglassPaneproperty for the wrapped component.voidsetLayeredPane(JLayeredPane layeredPane) Sets thelayeredPaneproperty for the wrapped component.voidsetMaximizationLayer(Integer layer) Deprecated.dead code last used in 0.2.0voidDeprecated.dead code last used in 0.2.0protected voidsetRootContainer(Component root) Sets the wrapped root container.voidtoFront()void
-
Field Details
-
DEFAULT_MAXED_LAYER
-
-
Constructor Details
-
RootWindow
Creates a newRootSwingContainerwrapping the specified component.
-
-
Method Details
-
getRootContainer
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
Indicates whether the suppliedComponentis, in fact, a root Swing container.- Parameters:
c- theComponentwe wish to check
-
getVisibleWindows
-
getContentPane
Returns thecontentPaneobject for the wrapped component.- Returns:
- the
contentPaneproperty
-
getGlassPane
Returns theglassPaneobject for the wrapped component.- Returns:
- the
glassPaneproperty
-
getLayeredPane
Returns thelayeredPaneobject for the wrapped component.- Returns:
- the
layeredPaneproperty
-
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
Deprecated.dead code last used in 0.2.0Returns the layer associated withComponentmaximization.- Returns:
- an
Integerindicating the maximization layer property
-
getMaximizedLayout
Deprecated.dead code last used in 0.2.0Returns theLayoutManagerassociated withComponentmaximization within theRootSwingContainer.- Returns:
- a
LayoutManagerindicating the maximization layout property
-
getRootContainer
Returns the the wrapped component. (JFrame,JApplet, etc...)- Returns:
- the wrapped root container
-
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
Sets thecontentPaneproperty for the wrapped component.- Parameters:
contentPane- thecontentPaneobject for the wrapped component
-
setGlassPane
Sets theglassPaneproperty for the wrapped component.- Parameters:
glassPane- theglassPaneobject for the wrapped component
-
setLayeredPane
Sets thelayeredPaneproperty for the wrapped component.- Parameters:
layeredPane- thelayeredPaneobject for the wrapped component
-
getOwnedWindows
Return an array containing all the windows this window currently owns.- Returns:
- all the windows currently owned by this root window.
-
setMaximizationLayer
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
Deprecated.dead code last used in 0.2.0Sets theLayoutManagerassociated withComponentmaximization within theRootSwingContainer.- Parameters:
mgr- theLayoutManagerassociated withComponentmaximization within theRootSwingContainer.
-
setRootContainer
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
-
getBounds
-
putClientProperty
-
getClientProperty
-