swpchat.client.gui
Class GbcControl

java.lang.Object
  |
  +--swpchat.client.gui.GbcControl

public class GbcControl
extends java.lang.Object

Class to handle GridBagLayout more comfortable. Example: this.setLayout(new GridBagLayout()); JButton button = new JButton(); GbcControl con = new GbcControl(); con.constrain( this, button, 0, // gridx 0, // gridy 1, // gridwidth 1, // gridheight GbcControl.CENTER );

Since:
23.01.2000
Author:
msturm

Field Summary
static int BOTH
          Components are scaled in both directions to the cell size (fill).
static int CENTER
          Put component in the center of the selected cell (anchor).
private static int defaultAnchor
           
private static int defaultFill
           
private static int defaultGridheight
           
private static int defaultGridwidth
           
private static java.awt.Insets defaultInsets
           
private static double defaultWeightx
           
private static double defaultWeighty
           
static int EAST
          Put component in the east of the selected cell (anchor).
private  java.awt.GridBagConstraints gbc
           
static int HORIZONTAL
          Components are scaled horizontally to the cell size (fill).
static int NONE
          Components are not scaled to the cell size (fill).
static int NORTH
          Put component in the north of the selected cell (anchor).
static int NORTHEAST
          Put component in the northeast of the selected cell (anchor).
static int NORTHWEST
          Put component in the northwest of the selected cell (anchor).
static int SOUTH
          Put component in the south of the selected cell (anchor).
static int SOUTHEAST
          Put component in the southeast of the selected cell (anchor).
static int SOUTHWEST
          Put component in the southwest of the selected cell (anchor).
static int VERTICAL
          Components not scaled vertically to the cell size (fill).
static int WEST
          Put component in the west of the selected cell (anchor).
 
Constructor Summary
GbcControl()
          creates instance of GbcControl and sets default values.
 
Method Summary
 void constrain(java.awt.Container container, java.awt.Component component, int gridx, int gridy)
          Adds the component to the container with the specified gbc settings.
 void constrain(java.awt.Container container, java.awt.Component component, int gridx, int gridy, int gridwidth, int gridheight)
          Adds the component to the container with the specified gbc settings.
 void constrain(java.awt.Container container, java.awt.Component component, int gridx, int gridy, int gridwidth, int gridheight, int anchor)
          Adds the component to the container with the specified gbc settings.
 void constrain(java.awt.Container container, java.awt.Component component, int gridx, int gridy, int gridwidth, int gridheight, int anchor, java.awt.Insets insets)
          Adds the component to the container with the specified gbc settings.
 void setAnchor(int anchor)
          Sets anchor to the specified value.
 void setBottomInset(int inset)
          Sets the bottom inset to the specified value.
 void setFill(int fill)
          Sets fill to the specified value.
 void setInsets(java.awt.Insets insets)
          Sets the insets to the specified value.
 void setLeftInset(int inset)
          Sets the left inset to the specified value.
 void setRightInset(int inset)
          Sets the right inset to the specified value.
 void setTopInset(int inset)
          Sets the top inset to the specified value.
 void setWeightx(double weightx)
          Sets weightx to the specified value.
 void setWeighty(double weighty)
          Sets weighty to the specified value.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

CENTER

public static final int CENTER
Put component in the center of the selected cell (anchor).

NORTH

public static final int NORTH
Put component in the north of the selected cell (anchor).

NORTHEAST

public static final int NORTHEAST
Put component in the northeast of the selected cell (anchor).

EAST

public static final int EAST
Put component in the east of the selected cell (anchor).

SOUTHEAST

public static final int SOUTHEAST
Put component in the southeast of the selected cell (anchor).

SOUTH

public static final int SOUTH
Put component in the south of the selected cell (anchor).

SOUTHWEST

public static final int SOUTHWEST
Put component in the southwest of the selected cell (anchor).

WEST

public static final int WEST
Put component in the west of the selected cell (anchor).

NORTHWEST

public static final int NORTHWEST
Put component in the northwest of the selected cell (anchor).

NONE

public static final int NONE
Components are not scaled to the cell size (fill).

BOTH

public static final int BOTH
Components are scaled in both directions to the cell size (fill).

HORIZONTAL

public static final int HORIZONTAL
Components are scaled horizontally to the cell size (fill).

VERTICAL

public static final int VERTICAL
Components not scaled vertically to the cell size (fill).

defaultInsets

private static final java.awt.Insets defaultInsets

defaultGridwidth

private static final int defaultGridwidth

defaultGridheight

private static final int defaultGridheight

defaultFill

private static final int defaultFill

defaultAnchor

private static final int defaultAnchor

defaultWeightx

private static final double defaultWeightx

defaultWeighty

private static final double defaultWeighty

gbc

private java.awt.GridBagConstraints gbc
Constructor Detail

GbcControl

public GbcControl()
creates instance of GbcControl and sets default values.
Method Detail

constrain

public void constrain(java.awt.Container container,
                      java.awt.Component component,
                      int gridx,
                      int gridy)
Adds the component to the container with the specified gbc settings.

constrain

public void constrain(java.awt.Container container,
                      java.awt.Component component,
                      int gridx,
                      int gridy,
                      int gridwidth,
                      int gridheight)
Adds the component to the container with the specified gbc settings.

constrain

public void constrain(java.awt.Container container,
                      java.awt.Component component,
                      int gridx,
                      int gridy,
                      int gridwidth,
                      int gridheight,
                      int anchor)
Adds the component to the container with the specified gbc settings.

constrain

public void constrain(java.awt.Container container,
                      java.awt.Component component,
                      int gridx,
                      int gridy,
                      int gridwidth,
                      int gridheight,
                      int anchor,
                      java.awt.Insets insets)
Adds the component to the container with the specified gbc settings.

setInsets

public void setInsets(java.awt.Insets insets)
Sets the insets to the specified value.

setLeftInset

public void setLeftInset(int inset)
Sets the left inset to the specified value.

setRightInset

public void setRightInset(int inset)
Sets the right inset to the specified value.

setTopInset

public void setTopInset(int inset)
Sets the top inset to the specified value.

setBottomInset

public void setBottomInset(int inset)
Sets the bottom inset to the specified value.

setWeightx

public void setWeightx(double weightx)
Sets weightx to the specified value.

setWeighty

public void setWeighty(double weighty)
Sets weighty to the specified value.

setAnchor

public void setAnchor(int anchor)
Sets anchor to the specified value.

setFill

public void setFill(int fill)
Sets fill to the specified value.