com.javadocking.util
Class SwingUtil

java.lang.Object
  extended by com.javadocking.util.SwingUtil

public class SwingUtil
extends java.lang.Object

This class contains a collection of static utility methods for Swing.

Author:
Heidi Rakels.

Method Summary
static java.awt.Container getContentPane(java.awt.Window window)
          Gets the content pane of the given window.
static javax.swing.JLayeredPane getLayeredPane(javax.swing.JRootPane rootPane)
          Gets the layered pane of the window of the given component.
static javax.swing.JRootPane getRootPane(java.awt.Component component)
          Gets the root pane of the given component.
static javax.swing.JRootPane getRootPane(java.awt.Window window)
          Gets the root pane of the window.
static boolean isLocationInScreenBounds(java.awt.Point location)
          Verifies if the given point is visible on the screen.
static boolean locationInComponentVisible(java.awt.Point location, java.awt.Component component)
           Determines if the component is visible in its window at the given screen location.
static void repaintParent(javax.swing.JComponent component)
          Repaints the parent of the given component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

repaintParent

public static void repaintParent(javax.swing.JComponent component)
Repaints the parent of the given component. If the parent is null, the component itself is repainted.

Parameters:
component - The component whose parent will be repainted.

getRootPane

public static javax.swing.JRootPane getRootPane(java.awt.Component component)
Gets the root pane of the given component.

Parameters:
component - The component whose root pane is retrieved.
Returns:
The root pane of the component.

getRootPane

public static javax.swing.JRootPane getRootPane(java.awt.Window window)
Gets the root pane of the window. The window should be a javax.swing.JFrame, javax.swing.JDialog or javax.swing.JWindow. Otherwise null is returned.

Parameters:
window - The window whose root pane is retrieved.
Returns:
The root pane of the window of the component.

getLayeredPane

public static javax.swing.JLayeredPane getLayeredPane(javax.swing.JRootPane rootPane)
Gets the layered pane of the window of the given component. The window of the root pane should be a javax.swing.JFrame, javax.swing.JDialog or javax.swing.JWindow. Otherwise the layered pane of the rootpane is returned.

Parameters:
rootPane - The root pane whose layered pane is retrieved.
Returns:
The layered pane.

getContentPane

public static java.awt.Container getContentPane(java.awt.Window window)
Gets the content pane of the given window.

Parameters:
window - The window. It should inherit from javax.swing.JFrame, javax.swing.JDialog or javax.swing.JWindow.
Returns:
The content pane of the window. If the given window is not a javax.swing.JFrame, javax.swing.JDialog or javax.swing.JWindow, null is returned.

isLocationInScreenBounds

public static boolean isLocationInScreenBounds(java.awt.Point location)
Verifies if the given point is visible on the screen.

Parameters:
location - The given location on the screen.
Returns:
True if the location is on the screen, false otherwise.

locationInComponentVisible

public static boolean locationInComponentVisible(java.awt.Point location,
                                                 java.awt.Component component)

Determines if the component is visible in its window at the given screen location.

Parameters:
location - A location on the screen.
component - A component in a window.
Returns:
True if the component is visible in its window at the given screen location.