org.bdgp.swing
Class SwingUtil

java.lang.Object
  |
  +--org.bdgp.swing.SwingUtil

public class SwingUtil
extends java.lang.Object

A pile of useful methods for Swing applications.


Method Summary
static void blockUntilImagePrepared(java.awt.Image in)
          Forces the current thread to yield until the given image has completely loaded.
static void center(java.awt.Window win)
          Places a Window in the center of the screen.
static java.lang.String imageObserverInfoflagToString(int infoflag)
          Decodes the bits of a java.awt.image.ImageObserver infoflag into a human readable string.
static void sizeToPreferred(java.awt.Component comp)
          Resizes a Component to its preferred size
static void sizeToPreferred(javax.swing.JDialog dialog)
          Resizes a JDialog to its preferred size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

center

public static void center(java.awt.Window win)
Places a Window in the center of the screen.
Parameters:
win - the window to center

sizeToPreferred

public static void sizeToPreferred(javax.swing.JDialog dialog)
Resizes a JDialog to its preferred size.
Parameters:
dialog - the dialog box to resize

sizeToPreferred

public static void sizeToPreferred(java.awt.Component comp)
Resizes a Component to its preferred size
Parameters:
comp - the component to resize

blockUntilImagePrepared

public static void blockUntilImagePrepared(java.awt.Image in)
Forces the current thread to yield until the given image has completely loaded. This is useful if you need to guarantee that an image has fully loaded.
Parameters:
in - the image being loaded

imageObserverInfoflagToString

public static java.lang.String imageObserverInfoflagToString(int infoflag)
Decodes the bits of a java.awt.image.ImageObserver infoflag into a human readable string.
Parameters:
infoflag - the flag to decode
Returns:
a string describing the flag