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 java.awt.Component getGlassPane(java.awt.Component component)
          Gets the glass pane of the window of the given component.
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 window 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.

getGlassPane

public static java.awt.Component getGlassPane(java.awt.Component component)
Gets the glass pane of the window of the given component. The window of the component should be a javax.swing.JFrame, javax.swing.JDialog or javax.swing.JWindow. Otherwise null is returned.

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

getRootPane

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

Parameters:
component - The component whose root pane is retrieved.
Returns:
The root pane of the window 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 null is returned.

Parameters:
rootPane - The root pane whose layered pane is retrieved.
Returns:
The layered of the window of the root 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.