public class GridBagLayout extends Object implements Serializable, LayoutManager2
| Modifier and Type | Field and Description |
|---|---|
double[] |
columnWeights |
int[] |
columnWidths |
protected Hashtable<Component,GridBagConstraints> |
comptable |
protected GridBagConstraints |
defaultConstraints |
protected java.awt.GridBagLayoutInfo |
layoutInfo |
protected static int |
MAXGRIDSIZE |
protected static int |
MINSIZE |
protected static int |
PREFERREDSIZE |
int[] |
rowHeights |
double[] |
rowWeights |
| Constructor and Description |
|---|
GridBagLayout() |
| Modifier and Type | Method and Description |
|---|---|
void |
addLayoutComponent(Component component,
Object constraints)
Adds the specified component to the layout, with the specified
constraints object.
|
void |
addLayoutComponent(String name,
Component component)
Adds the specified component to the layout group.
|
protected void |
adjustForGravity(GridBagConstraints constraints,
Rectangle r)
Move and resize a rectangle according to a set of grid bag
constraints.
|
protected void |
AdjustForGravity(GridBagConstraints constraints,
Rectangle r)
Move and resize a rectangle according to a set of grid bag
constraints.
|
protected void |
arrangeGrid(Container parent) |
protected void |
ArrangeGrid(Container parent)
Obsolete.
|
GridBagConstraints |
getConstraints(Component component) |
float |
getLayoutAlignmentX(Container target)
Returns the preferred X axis alignment for the specified target
container.
|
float |
getLayoutAlignmentY(Container target)
Returns the preferred Y axis alignment for the specified target
container.
|
int[][] |
getLayoutDimensions() |
protected java.awt.GridBagLayoutInfo |
getLayoutInfo(Container parent,
int sizeflag) |
protected java.awt.GridBagLayoutInfo |
GetLayoutInfo(Container parent,
int sizeflag)
Obsolete.
|
Point |
getLayoutOrigin() |
double[][] |
getLayoutWeights() |
protected Dimension |
getMinSize(Container parent,
java.awt.GridBagLayoutInfo info) |
protected Dimension |
GetMinSize(Container parent,
java.awt.GridBagLayoutInfo info)
Obsolete.
|
void |
invalidateLayout(Container target)
Forces the layout manager to purge any cached information about the
layout of the target container.
|
void |
layoutContainer(Container parent)
Lays out the components in the given container.
|
Point |
location(int x,
int y) |
protected GridBagConstraints |
lookupConstraints(Component component) |
Dimension |
maximumLayoutSize(Container target)
Determines the maximum size of the specified target container.
|
Dimension |
minimumLayoutSize(Container parent)
Calculates the minimum size for this container, taking into account
the components it contains.
|
Dimension |
preferredLayoutSize(Container parent)
Calculates the preferred size for this container, taking into account
the components it contains.
|
void |
removeLayoutComponent(Component component)
Removes the specified component from the layout group.
|
void |
setConstraints(Component component,
GridBagConstraints constraints) |
String |
toString()
Return a string representation of this GridBagLayout.
|
protected static final int MINSIZE
protected static final int PREFERREDSIZE
protected static final int MAXGRIDSIZE
protected Hashtable<Component,GridBagConstraints> comptable
protected java.awt.GridBagLayoutInfo layoutInfo
protected GridBagConstraints defaultConstraints
public double[] columnWeights
public int[] columnWidths
public double[] rowWeights
public int[] rowHeights
public GridBagLayout()
public void addLayoutComponent(String name, Component component)
LayoutManageraddLayoutComponent in interface LayoutManagername - the name of the component to addcomponent - the component to addpublic void removeLayoutComponent(Component component)
LayoutManagerremoveLayoutComponent in interface LayoutManagercomponent - the component to removepublic void addLayoutComponent(Component component, Object constraints)
LayoutManager2addLayoutComponent in interface LayoutManager2component - the component to addconstraints - the constraints to satisfypublic Dimension preferredLayoutSize(Container parent)
LayoutManagerpreferredLayoutSize in interface LayoutManagerparent - the parent container to lay outLayoutManager.minimumLayoutSize(Container)public Dimension minimumLayoutSize(Container parent)
LayoutManagerminimumLayoutSize in interface LayoutManagerparent - the parent container to lay outLayoutManager.preferredLayoutSize(Container)public Dimension maximumLayoutSize(Container target)
LayoutManager2maximumLayoutSize in interface LayoutManager2target - the container to lay outComponent.getMaximumSize()public void layoutContainer(Container parent)
LayoutManagerlayoutContainer in interface LayoutManagerparent - the container to lay outpublic float getLayoutAlignmentX(Container target)
LayoutManager2getLayoutAlignmentX in interface LayoutManager2target - the target containerpublic float getLayoutAlignmentY(Container target)
LayoutManager2getLayoutAlignmentY in interface LayoutManager2target - the target containerpublic void invalidateLayout(Container target)
LayoutManager2invalidateLayout in interface LayoutManager2target - the target containerpublic void setConstraints(Component component, GridBagConstraints constraints)
public GridBagConstraints getConstraints(Component component)
protected GridBagConstraints lookupConstraints(Component component)
public Point getLayoutOrigin()
public int[][] getLayoutDimensions()
public double[][] getLayoutWeights()
public String toString()
toString in class ObjectObject.getClass(),
Object.hashCode(),
Class.getName(),
Integer.toHexString(int)protected void AdjustForGravity(GridBagConstraints constraints, Rectangle r)
constraints - position and size constraintsr - rectangle to be moved and resizedprotected void ArrangeGrid(Container parent)
protected java.awt.GridBagLayoutInfo GetLayoutInfo(Container parent, int sizeflag)
protected Dimension GetMinSize(Container parent, java.awt.GridBagLayoutInfo info)
protected Dimension getMinSize(Container parent, java.awt.GridBagLayoutInfo info)
protected void arrangeGrid(Container parent)
protected java.awt.GridBagLayoutInfo getLayoutInfo(Container parent, int sizeflag)
protected void adjustForGravity(GridBagConstraints constraints, Rectangle r)
constraints - position and size constraintsr - rectangle to be moved and resized