org.pf.swing
Class SwingUtil

java.lang.Object
  extended by org.pf.swing.SwingUtil

public class SwingUtil
extends java.lang.Object

Provides support and convenience and helper methods for Swing based UI.

Version:
1.4
Author:
Manfred Duchrow

Method Summary
 void centerFrame(javax.swing.JFrame frame)
          Change the given frames upper left corner coordinates, so that it will be shown in the center of the screen.
 void centerFrame(javax.swing.JFrame frame, int width, int height)
          Change the given frame's upper left corner coordinates, so that it will be shown in the center of the screen according to the specified width and height.
 void centerWindow(java.awt.Window window)
          Change the given window's upper left corner coordinates, so that it will be shown in the center of the screen.
 void centerWindow(java.awt.Window window, int width, int height)
          Change the given window's upper left corner coordinates, so that it will be shown in the center of the screen according to the specified width and height.
static SwingUtil current()
          Returns the single instance of this class.
 java.awt.Component findComponent(java.awt.Container container, java.lang.Class componentType, java.lang.String componentName)
          Searches for the component with the specified type and name in the given container and all sub containers.
 java.awt.Component findComponent(java.awt.Container container, java.lang.String componentName)
          Searches for the component with the specified name in the given container and all sub containers.
 void setSystemLookAndFeel()
          Activates the look & feel for the current operating system.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

current

public static SwingUtil current()
Returns the single instance of this class.


centerWindow

public void centerWindow(java.awt.Window window,
                         int width,
                         int height)
Change the given window's upper left corner coordinates, so that it will be shown in the center of the screen according to the specified width and height.

Parameters:
window - The window that must be centered
width - The width of the window
height - The height of the window

centerWindow

public void centerWindow(java.awt.Window window)
Change the given window's upper left corner coordinates, so that it will be shown in the center of the screen.

Parameters:
window - The window that must be centered

centerFrame

public void centerFrame(javax.swing.JFrame frame,
                        int width,
                        int height)
Change the given frame's upper left corner coordinates, so that it will be shown in the center of the screen according to the specified width and height.

Parameters:
frame - The frame that must be centered
width - The width of the frame
height - The height of the frame

centerFrame

public void centerFrame(javax.swing.JFrame frame)
Change the given frames upper left corner coordinates, so that it will be shown in the center of the screen.

Parameters:
frame - The frame that must be centered

setSystemLookAndFeel

public void setSystemLookAndFeel()
Activates the look & feel for the current operating system.


findComponent

public java.awt.Component findComponent(java.awt.Container container,
                                        java.lang.String componentName)
Searches for the component with the specified name in the given container and all sub containers. Returns null if the component cannot be found, otherwise the found component.

Parameters:
container - The container in which to search
componentName - The name of the component

findComponent

public java.awt.Component findComponent(java.awt.Container container,
                                        java.lang.Class componentType,
                                        java.lang.String componentName)
Searches for the component with the specified type and name in the given container and all sub containers. Returns null if the component cannot be found, otherwise the found component.

Parameters:
container - The container in which to search
componentType - The type of the component (may be null)
componentName - The name of the component (may be null)