common.gui.util
Class ConstraintFactory

java.lang.Object
  extended bycommon.gui.util.ConstraintFactory

public class ConstraintFactory
extends java.lang.Object

Provides easier creation of GridBagConstraints

Author:
mace

Field Summary
static int BOTH
           
static int CENTER
           
protected  int DEFAULT_ANCHOR
           
protected  int DEFAULT_FILL
           
protected  java.awt.Insets DEFAULT_INSETS
           
protected  int DEFAULT_IPADX
           
protected  int DEFAULT_IPADY
           
protected  int DEFAULT_WEIGHTX
           
protected  int DEFAULT_WEIGHTY
           
static int E
           
static int H
           
static int HORIZONTAL
           
protected  int LAST_HEIGHT
           
protected  int LAST_WIDTH
           
protected  int LAST_X
           
protected  int LAST_Y
           
static int N
           
static int NE
           
static int NONE
           
static int NW
           
static int RELATIVE
           
static int REMAINDER
           
static int S
           
static int SE
           
static int SW
           
static int V
           
static int VERTICAL
           
static int W
           
 
Constructor Summary
ConstraintFactory()
           
 
Method Summary
 java.awt.GridBagConstraints buildConstraints(int x, int y, int width, int height)
          Build basic constraints.
 java.awt.GridBagConstraints buildConstraints(int x, int y, int width, int height, int anchor, int fill)
          Builds basic constraints + anchor and fill constraints.
 java.awt.GridBagConstraints buildConstraints(int x, int y, int width, int height, int anchor, int fill, int xweight, int yweight)
          Builds basic constraints + anchor,fill, and weights.
 java.awt.GridBagConstraints buildConstraints(int x, int y, int width, int height, int anchor, int fill, int weightx, int weighty, java.awt.Insets i)
          Builds basic constraints + anchor,fill, weights, and insets.
 void setDefaultAnchor(int i)
           
 void setDefaultFill(int i)
           
 void setDefaultInsets(java.awt.Insets i)
           
 void setDefaultInternalPadding(int i)
           
 void setDefaultInternalPaddingX(int i)
           
 void setDefaultInternalPaddingY(int i)
           
 void setDefaultWeights(int x, int y)
           
 void setDefaultWeightX(int i)
           
 void setDefaultWeightY(int i)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
See Also:
Constant Field Values

BOTH

public static final int BOTH
See Also:
Constant Field Values

HORIZONTAL

public static final int HORIZONTAL
See Also:
Constant Field Values

H

public static final int H
See Also:
Constant Field Values

VERTICAL

public static final int VERTICAL
See Also:
Constant Field Values

V

public static final int V
See Also:
Constant Field Values

RELATIVE

public static final int RELATIVE
See Also:
Constant Field Values

REMAINDER

public static final int REMAINDER
See Also:
Constant Field Values

CENTER

public static final int CENTER
See Also:
Constant Field Values

N

public static final int N
See Also:
Constant Field Values

E

public static final int E
See Also:
Constant Field Values

S

public static final int S
See Also:
Constant Field Values

W

public static final int W
See Also:
Constant Field Values

NW

public static final int NW
See Also:
Constant Field Values

NE

public static final int NE
See Also:
Constant Field Values

SW

public static final int SW
See Also:
Constant Field Values

SE

public static final int SE
See Also:
Constant Field Values

DEFAULT_WEIGHTX

protected int DEFAULT_WEIGHTX

DEFAULT_WEIGHTY

protected int DEFAULT_WEIGHTY

DEFAULT_ANCHOR

protected int DEFAULT_ANCHOR

DEFAULT_FILL

protected int DEFAULT_FILL

DEFAULT_INSETS

protected java.awt.Insets DEFAULT_INSETS

DEFAULT_IPADX

protected int DEFAULT_IPADX

DEFAULT_IPADY

protected int DEFAULT_IPADY

LAST_X

protected int LAST_X

LAST_Y

protected int LAST_Y

LAST_WIDTH

protected int LAST_WIDTH

LAST_HEIGHT

protected int LAST_HEIGHT
Constructor Detail

ConstraintFactory

public ConstraintFactory()
Method Detail

buildConstraints

public java.awt.GridBagConstraints buildConstraints(int x,
                                                    int y,
                                                    int width,
                                                    int height)
Build basic constraints. weights default to 100, anchor defaults to NW, fill defaults to BOTH. If a negative value is given, the last non-negative value will be re-used

Parameters:
x - an int specifying the object's x grid position
y - an int specifying the object's y grid position
width - an int specifying the object's width
height - an int specifying the object's height
Returns:
a GridBagConstraints object

buildConstraints

public java.awt.GridBagConstraints buildConstraints(int x,
                                                    int y,
                                                    int width,
                                                    int height,
                                                    int anchor,
                                                    int fill)
Builds basic constraints + anchor and fill constraints. Weights default to 100

Parameters:
x - an int specifying the object's x grid position
y - an int specifying the object's y grid position
width - an int specifying the object's width
height - an int specifying the object's height
anchor - an int specifying the position to place the object
fill - an int specifying which directions to fill
Returns:
a GridBagConstraints object

buildConstraints

public java.awt.GridBagConstraints buildConstraints(int x,
                                                    int y,
                                                    int width,
                                                    int height,
                                                    int anchor,
                                                    int fill,
                                                    int xweight,
                                                    int yweight)
Builds basic constraints + anchor,fill, and weights.

Parameters:
x - an int specifying the object's x grid position
y - an int specifying the object's y grid position
width - an int specifying the object's width
height - an int specifying the object's height
anchor - an int specifying the position to place the object
fill - an int specifying which directions to fill
xweight - an int specifying the object's x weight
yweight - an int specifying the object's y weight
Returns:
a GridBagConstraints object

buildConstraints

public java.awt.GridBagConstraints buildConstraints(int x,
                                                    int y,
                                                    int width,
                                                    int height,
                                                    int anchor,
                                                    int fill,
                                                    int weightx,
                                                    int weighty,
                                                    java.awt.Insets i)
Builds basic constraints + anchor,fill, weights, and insets.

Parameters:
x - an int specifying the object's x grid position
y - an int specifying the object's y grid position
width - an int specifying the object's width
height - an int specifying the object's height
anchor - an int specifying the position to place the object
fill - an int specifying which directions to fill
weightx - an int specifying the object's x weight
weighty - an int specifying the object's y weight
i - Insets to use for this object
Returns:
a GridBagConstraints object

setDefaultAnchor

public void setDefaultAnchor(int i)

setDefaultFill

public void setDefaultFill(int i)

setDefaultWeights

public void setDefaultWeights(int x,
                              int y)

setDefaultWeightX

public void setDefaultWeightX(int i)

setDefaultWeightY

public void setDefaultWeightY(int i)

setDefaultInsets

public void setDefaultInsets(java.awt.Insets i)

setDefaultInternalPaddingX

public void setDefaultInternalPaddingX(int i)

setDefaultInternalPaddingY

public void setDefaultInternalPaddingY(int i)

setDefaultInternalPadding

public void setDefaultInternalPadding(int i)