Class RootWindow

java.lang.Object
org.flexdock.util.RootWindow

public class RootWindow extends Object
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 Details

    • DEFAULT_MAXED_LAYER

      public static final Integer DEFAULT_MAXED_LAYER
  • Constructor Details

    • RootWindow

      protected RootWindow(Component root)
      Creates a new RootSwingContainer wrapping the specified component.
  • Method Details

    • getRootContainer

      public static RootWindow getRootContainer(Component c)
      Traverses the container hierarchy to locate the root container and returns corresponding RootSwingContainer. If c is null, a null reference is returned.
      Parameters:
      c - the container whose root we wish to find
      Returns:
      the enclosing RootSwingcontainer
    • isValidRootContainer

      public static boolean isValidRootContainer(Component c)
      Indicates whether the supplied Component is, in fact, a root Swing container.
      Parameters:
      c - the Component we wish to check
    • getVisibleWindows

      public static RootWindow[] getVisibleWindows()
    • getContentPane

      public Container getContentPane()
      Returns the contentPane object for the wrapped component.
      Returns:
      the contentPane property
    • getGlassPane

      public Component getGlassPane()
      Returns the glassPane object for the wrapped component.
      Returns:
      the glassPane property
    • getLayeredPane

      public JLayeredPane getLayeredPane()
      Returns the layeredPane object for the wrapped component.
      Returns:
      the layeredPane property
    • getLocationOnScreen

      public 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 Integer getMaximizationLayer()
      Deprecated.
      dead code last used in 0.2.0
      Returns the layer associated with Component maximization.
      Returns:
      an Integer indicating the maximization layer property
    • getMaximizedLayout

      public LayoutManager getMaximizedLayout()
      Deprecated.
      dead code last used in 0.2.0
      Returns the LayoutManager associated with Component maximization within the RootSwingContainer.
      Returns:
      a LayoutManager indicating the maximization layout property
    • getRootContainer

      public Component getRootContainer()
      Returns the the wrapped component. (JFrame, JApplet, etc...)
      Returns:
      the wrapped root container
    • getRootPane

      public JRootPane getRootPane()
      Returns the rootPane object for the wrapped component.
      Returns:
      the rootPane property
    • revalidateContentPane

      public void revalidateContentPane()
      Convenience method that calls revalidate() on the current content pane if it is a JComponent. If not, no action is taken.
    • setContentPane

      public void setContentPane(Container contentPane)
      Sets the contentPane property for the wrapped component.
      Parameters:
      contentPane - the contentPane object for the wrapped component
    • setGlassPane

      public void setGlassPane(Component glassPane)
      Sets the glassPane property for the wrapped component.
      Parameters:
      glassPane - the glassPane object for the wrapped component
    • setLayeredPane

      public void setLayeredPane(JLayeredPane layeredPane)
      Sets the layeredPane property for the wrapped component.
      Parameters:
      layeredPane - the layeredPane object for the wrapped component
    • getOwnedWindows

      public 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(Integer layer)
      Deprecated.
      dead code last used in 0.2.0
      Sets the layer associated with Component maximization within the RootSwingContainer. If layer is null, DEFAULT_MAXED_LAYER is used instead.
      Parameters:
      layer - an Integer indicating the maximization layer property
    • setMaximizedLayout

      public void setMaximizedLayout(LayoutManager mgr)
      Deprecated.
      dead code last used in 0.2.0
      Sets the LayoutManager associated with Component maximization within the RootSwingContainer.
      Parameters:
      mgr - the LayoutManager associated with Component maximization within the RootSwingContainer.
    • setRootContainer

      protected void setRootContainer(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 Window getOwner()
    • getBounds

      public Rectangle getBounds()
    • putClientProperty

      public void putClientProperty(Object key, Object value)
    • getClientProperty

      public Object getClientProperty(Object key)