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
ConstructorsModifierConstructorDescriptionprotected
RootWindow
(Component root) Creates a newRootSwingContainer
wrapping the specified component. -
Method Summary
Modifier and TypeMethodDescriptiongetClientProperty
(Object key) Returns thecontentPane
object for the wrapped component.Returns theglassPane
object for the wrapped component.Returns thelayeredPane
object 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 RootWindow
Traverses the container hierarchy to locate the root container and returns correspondingRootSwingContainer
.Returns therootPane
object for the wrapped component.static RootWindow[]
boolean
isActive()
static boolean
Indicates whether the suppliedComponent
is, in fact, a root Swing container.void
pack()
void
putClientProperty
(Object key, Object value) void
Convenience method that callsrevalidate()
on the current content pane if it is aJComponent
.void
setContentPane
(Container contentPane) Sets thecontentPane
property for the wrapped component.void
setGlassPane
(Component glassPane) Sets theglassPane
property for the wrapped component.void
setLayeredPane
(JLayeredPane layeredPane) Sets thelayeredPane
property for the wrapped component.void
setMaximizationLayer
(Integer layer) Deprecated.dead code last used in 0.2.0void
Deprecated.dead code last used in 0.2.0protected void
setRootContainer
(Component root) Sets the wrapped root container.void
toFront()
void
-
Field Details
-
DEFAULT_MAXED_LAYER
-
-
Constructor Details
-
RootWindow
Creates a newRootSwingContainer
wrapping the specified component.
-
-
Method Details
-
getRootContainer
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
Indicates whether the suppliedComponent
is, in fact, a root Swing container.- Parameters:
c
- theComponent
we wish to check
-
getVisibleWindows
-
getContentPane
Returns thecontentPane
object for the wrapped component.- Returns:
- the
contentPane
property
-
getGlassPane
Returns theglassPane
object for the wrapped component.- Returns:
- the
glassPane
property
-
getLayeredPane
Returns thelayeredPane
object for the wrapped component.- Returns:
- the
layeredPane
property
-
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
Deprecated.dead code last used in 0.2.0Returns the layer associated withComponent
maximization.- Returns:
- an
Integer
indicating the maximization layer property
-
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
Returns the the wrapped component. (JFrame
,JApplet
, etc...)- Returns:
- the wrapped root container
-
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
Sets thecontentPane
property for the wrapped component.- Parameters:
contentPane
- thecontentPane
object for the wrapped component
-
setGlassPane
Sets theglassPane
property for the wrapped component.- Parameters:
glassPane
- theglassPane
object for the wrapped component
-
setLayeredPane
Sets thelayeredPane
property for the wrapped component.- Parameters:
layeredPane
- thelayeredPane
object 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 withComponent
maximization within theRootSwingContainer
. Iflayer
isnull
, DEFAULT_MAXED_LAYER is used instead.- Parameters:
layer
- anInteger
indicating the maximization layer property
-
setMaximizedLayout
Deprecated.dead code last used in 0.2.0Sets theLayoutManager
associated withComponent
maximization within theRootSwingContainer
.- Parameters:
mgr
- theLayoutManager
associated withComponent
maximization 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
-