org.jurvis.awt
Class JvAWTUtilities

java.lang.Object
  extended by org.jurvis.awt.JvAWTUtilities

public final class JvAWTUtilities
extends Object

Various utility methods useful in creating AWT and Swing GUIs.

Author:
Neil W. Weber

Constructor Summary
JvAWTUtilities()
           
 
Method Summary
static void centerWindow(Window w)
          Center the given component within the screen.
static void centerWindow(Window parent, Window w)
          Center the given component within the bounds of another window.
static Dimension getMaxSize(Collection components)
          Return the largest size of the component in the given collection.
static Dimension getSize(JComponent comp, int numColumns)
          Return the amount of space needed to render the given number of columns.
static void setEnabled(Component component, boolean enabled)
          Enable or disable the specified component and, if it's a Container, its children components.
static void setFixedSize(JComponent comp, Dimension dim)
          Fix the size of the component to the given dimension.
static void setFixedSize(JComponent comp, int numColumns)
          Fix the fixed size of the component to the amount of space needed to render the given number of columns.
static void setSameSize(Collection components)
          Fix the size of all the components in the collection to the size of the largest component.
static void setSameSize(Collection components, Dimension size)
          Fix the size of all the components in the collection.
static void setSameSize(Component[] components)
          Fix the size of all the components in the array to the size of the largest component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JvAWTUtilities

public JvAWTUtilities()
Method Detail

centerWindow

public static void centerWindow(Window w)
Center the given component within the screen.

Parameters:
w - the window to center

centerWindow

public static void centerWindow(Window parent,
                                Window w)
Center the given component within the bounds of another window.

Parameters:
w - the window to center
parent - the window to center within

setEnabled

public static void setEnabled(Component component,
                              boolean enabled)
Enable or disable the specified component and, if it's a Container, its children components.

Parameters:
component - the component to modify
enabled - the enabled state

getMaxSize

public static Dimension getMaxSize(Collection components)
Return the largest size of the component in the given collection.

Parameters:
components - the collection of components

setSameSize

public static void setSameSize(Component[] components)
Fix the size of all the components in the array to the size of the largest component.

Parameters:
components - the array of components

setSameSize

public static void setSameSize(Collection components)
Fix the size of all the components in the collection to the size of the largest component.

Parameters:
components - the collection of components

setSameSize

public static void setSameSize(Collection components,
                               Dimension size)
Fix the size of all the components in the collection.

Parameters:
components - the collection of components
size - the size to fix

setFixedSize

public static void setFixedSize(JComponent comp,
                                Dimension dim)
Fix the size of the component to the given dimension.

Parameters:
comp - the component whose size to fix
dim - the dimension to fix the size of the component to

getSize

public static Dimension getSize(JComponent comp,
                                int numColumns)
Return the amount of space needed to render the given number of columns. The letter 'm' is used to estimate the average width of a column.

Parameters:
comp - the component whose size is desired
numColumns - the number of columns to size the label to

setFixedSize

public static void setFixedSize(JComponent comp,
                                int numColumns)
Fix the fixed size of the component to the amount of space needed to render the given number of columns. The letter 'm' is used to estimate the average width of a column.

Parameters:
comp - the component whose size to fix
numColumns - the number of columns to size the label to


Copyright © 1999-2004 Neil W. Weber. All Rights Reserved.