com.sdm.quasar.client.swing.common.util
Class GUIUtilities

java.lang.Object
  extended bycom.sdm.quasar.client.swing.common.util.GUIUtilities

public class GUIUtilities
extends java.lang.Object

This class contains useful functionality concerning Swing in form of static methods.

Version:
1.0
Author:
Bernd Olleck, sd&m AG

Constructor Summary
GUIUtilities()
           
 
Method Summary
static void centerWindow(java.awt.Window window, java.awt.Component parentComponent)
          Centers a given Window to the given parent component.
static java.awt.Window findFrame()
          Returns a frame that may be used as a parent for modal dialogs.
static java.awt.Window getWindow(java.awt.Component component)
          Returns the Window of the given Component or null, if the Component is not contained inside a Window.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GUIUtilities

public GUIUtilities()
Method Detail

findFrame

public static java.awt.Window findFrame()
Returns a frame that may be used as a parent for modal dialogs.

Note: Usually you know which frame or dialog is responsible for you and you should use that dialog as a parent if you display a modal dialog.

Tries to find a frame that is showing. If that fails it returns any existing frame. If no frame exists, it returns null.

Returns:
a window if possible, otherwise null

centerWindow

public static void centerWindow(java.awt.Window window,
                                java.awt.Component parentComponent)
Centers a given Window to the given parent component.

Parameters:
window - the Window to center
parentComponent - the Component in the window to center against or null to center to the screen

getWindow

public static java.awt.Window getWindow(java.awt.Component component)
Returns the Window of the given Component or null, if the Component is not contained inside a Window.

Parameters:
component - the Component to locate
Returns:
the Window of the given Component or null, if the Component is not contained inside a Window.