org.fuin.utils4swing.common
Class Utils4Swing

java.lang.Object
  extended by org.fuin.utils4swing.common.Utils4Swing

public final class Utils4Swing
extends java.lang.Object

Common utility methods for use in Swing applications and libraries.


Nested Class Summary
static class Utils4Swing.GlassPaneState
          State of the UI before showing a glass pane.
 
Method Summary
static javax.swing.JFrame createShowAndPosition(java.lang.String title, java.awt.Container content, boolean exitOnClose, boolean resizable, FramePositioner positioner)
           
static javax.swing.JFrame createShowAndPosition(java.lang.String title, java.awt.Container content, boolean exitOnClose, FramePositioner positioner)
          Create a new resizeable frame with a panel as it's content pane and position the frame.
static javax.swing.RootPaneContainer findRootPaneContainer(java.awt.Component source)
          Find the root pane container in the current hierarchy.
static void hideGlassPane(Utils4Swing.GlassPaneState state)
          Hides the glass pane and restores the saved state.
static void initLookAndFeel(java.lang.String className)
          Initializes the look and feel and wraps exceptions into a runtime exception.
static void initSystemLookAndFeel()
          Initializes the system look and feel and wraps exceptions into a runtime exception.If this method is called outside the EDT it will switch automatically to the UI thread using invokeAndWait(Runnable) .
static javax.swing.ImageIcon loadIcon(java.lang.Class clasz, java.lang.String name)
          Load an icon located in the same package as a given class.
static Utils4Swing.GlassPaneState showGlassPane(java.awt.Component source)
          Makes the glass pane visible and focused and stores the saves the current state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createShowAndPosition

public static javax.swing.JFrame createShowAndPosition(java.lang.String title,
                                                       java.awt.Container content,
                                                       boolean exitOnClose,
                                                       FramePositioner positioner)
Create a new resizeable frame with a panel as it's content pane and position the frame.

Parameters:
title - Frame title.
content - Content.
exitOnClose - Exit the program on closing the frame?
positioner - FramePositioner.
Returns:
A visible frame at the preferred position.

createShowAndPosition

public static javax.swing.JFrame createShowAndPosition(java.lang.String title,
                                                       java.awt.Container content,
                                                       boolean exitOnClose,
                                                       boolean resizable,
                                                       FramePositioner positioner)
Parameters:
title - Frame title.
content - Content.
exitOnClose - Exit the program on closing the frame?
resizable - If the frame should be resizeable TRUE else FALSE.
positioner - FramePositioner.
Returns:
A visible frame at the preferred position.

loadIcon

public static javax.swing.ImageIcon loadIcon(java.lang.Class clasz,
                                             java.lang.String name)
Load an icon located in the same package as a given class.

Parameters:
clasz - Class with the same package where the icon is located.
name - Filename of the icon.
Returns:
New icon instance.

initLookAndFeel

public static void initLookAndFeel(java.lang.String className)
Initializes the look and feel and wraps exceptions into a runtime exception. If this method is called outside the EDT it will switch automatically to the UI thread using invokeAndWait(Runnable) .

Parameters:
className - Full qualified name of the look and feel class.

initSystemLookAndFeel

public static void initSystemLookAndFeel()
Initializes the system look and feel and wraps exceptions into a runtime exception.If this method is called outside the EDT it will switch automatically to the UI thread using invokeAndWait(Runnable) .


findRootPaneContainer

public static javax.swing.RootPaneContainer findRootPaneContainer(java.awt.Component source)
Find the root pane container in the current hierarchy.

Parameters:
source - Component to start with.
Returns:
Root pane container or NULL if it cannot be found.

showGlassPane

public static Utils4Swing.GlassPaneState showGlassPane(java.awt.Component source)
Makes the glass pane visible and focused and stores the saves the current state.

Parameters:
source - Component to use when looking for the root pane container.
Returns:
State of the UI before the glasspane was visible.

hideGlassPane

public static void hideGlassPane(Utils4Swing.GlassPaneState state)
Hides the glass pane and restores the saved state.

Parameters:
state - State to restore.


Copyright © 2009 Future Invent Informationsmanagement GmbH. All Rights Reserved.