org.apache.airavata.common.utils
Class SwingUtil

java.lang.Object
  extended by org.apache.airavata.common.utils.SwingUtil

public class SwingUtil
extends Object


Field Summary
static Cursor CROSSHAIR_CURSOR
          Cross hair cursor.
static Cursor DEFAULT_CURSOR
          Default cursor.
static Cursor HAND_CURSOR
          Hand cursor.
static Dimension MINIMUM_SIZE
          Minimum size, zero.
static Cursor MOVE_CURSOR
          Move cursor.
static int PAD
          The default distance between components.
static Cursor WAIT_CURSOR
          Wait cursor.
static int WEIGHT_EQUALLY
          Weight all rows or columns equally.
static int WEIGHT_NONE
          Wight none of rows or eolumns.
 
Constructor Summary
SwingUtil()
           
 
Method Summary
static void addPlaceHolder(JTextField field, String placeHolderText)
           
static Image createImage(String filename)
          Creates an image from an image contained in the "images" directory.
static ImageIcon createImageIcon(String filename)
          Creates an icon from an image contained in the "images" directory.
static Frame getFrame(Component component)
          Return the Frame of a specified component if any.
static URL getImageURL(String filename)
           
static void layoutToGrid(Container parent, double[] rowWeights, double[] columnWeights)
           
static void layoutToGrid(Container parent, int numRow, int numColumn, int weightedRow, int weightedColumn)
          Layouts the child components of a specified parent component using GridBagLayout.
static void layoutToGrid(Container parent, List<Double> rowWeights, List<Double> columnWeights)
           
static void makeSpringCompactGrid(Container parent, int rows, int cols)
          Aligns the first rows * cols components of parent in a grid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINIMUM_SIZE

public static final Dimension MINIMUM_SIZE
Minimum size, zero.


PAD

public static final int PAD
The default distance between components.

See Also:
Constant Field Values

DEFAULT_CURSOR

public static final Cursor DEFAULT_CURSOR
Default cursor.


HAND_CURSOR

public static final Cursor HAND_CURSOR
Hand cursor.


CROSSHAIR_CURSOR

public static final Cursor CROSSHAIR_CURSOR
Cross hair cursor.


MOVE_CURSOR

public static final Cursor MOVE_CURSOR
Move cursor.


WAIT_CURSOR

public static final Cursor WAIT_CURSOR
Wait cursor.


WEIGHT_NONE

public static final int WEIGHT_NONE
Wight none of rows or eolumns. Used by layoutToGrid().

See Also:
Constant Field Values

WEIGHT_EQUALLY

public static final int WEIGHT_EQUALLY
Weight all rows or columns equally. Used by layoutToGrid().

See Also:
Constant Field Values
Constructor Detail

SwingUtil

public SwingUtil()
Method Detail

createImageIcon

public static ImageIcon createImageIcon(String filename)
Creates an icon from an image contained in the "images" directory.

Parameters:
filename -
Returns:
the ImageIcon created

createImage

public static Image createImage(String filename)
Creates an image from an image contained in the "images" directory.

Parameters:
filename -
Returns:
the Image created

getImageURL

public static URL getImageURL(String filename)

getFrame

public static Frame getFrame(Component component)
Return the Frame of a specified component if any.

Parameters:
component - the specified component
Returns:
the Frame of a specified component if any; otherwise null

layoutToGrid

public static void layoutToGrid(Container parent,
                                int numRow,
                                int numColumn,
                                int weightedRow,
                                int weightedColumn)
Layouts the child components of a specified parent component using GridBagLayout.

Parameters:
parent - The specified parent component
numRow - The number of rows
numColumn - The number of columns
weightedRow - The row to weight
weightedColumn - The column to weight

layoutToGrid

public static void layoutToGrid(Container parent,
                                double[] rowWeights,
                                double[] columnWeights)
Parameters:
parent -
rowWeights -
columnWeights -

layoutToGrid

public static void layoutToGrid(Container parent,
                                List<Double> rowWeights,
                                List<Double> columnWeights)
Parameters:
parent -
rowWeights -
columnWeights -

makeSpringCompactGrid

public static void makeSpringCompactGrid(Container parent,
                                         int rows,
                                         int cols)
Aligns the first rows * cols components of parent in a grid. Each component in a column is as wide as the maximum preferred width of the components in that column; height is similarly determined for each row. The parent is made just big enough to fit them all.

Parameters:
parent -
rows - number of rows
cols - number of columns

addPlaceHolder

public static void addPlaceHolder(JTextField field,
                                  String placeHolderText)


Copyright © 2011-2012 The Apache Software Foundation. All Rights Reserved.