Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.awt
Class GridBagLayout  view GridBagLayout download GridBagLayout.java

java.lang.Object
  extended byjava.awt.GridBagLayout
All Implemented Interfaces:
LayoutManager, LayoutManager2, java.io.Serializable

public class GridBagLayout
extends java.lang.Object
implements java.io.Serializable, LayoutManager2


Field Summary
 double[] columnWeights
           
 int[] columnWidths
           
protected  java.util.Hashtable comptable
           
protected  GridBagConstraints defaultConstraints
           
private  java.util.Hashtable internalcomptable
           
protected  GridBagLayoutInfo layoutInfo
           
protected static int MAXGRIDSIZE
           
protected static int MINSIZE
           
protected static int PREFERREDSIZE
           
 int[] rowHeights
           
 double[] rowWeights
           
private static long serialVersionUID
           
 
Constructor Summary
GridBagLayout()
           
 
Method Summary
 void addLayoutComponent(Component component, java.lang.Object constraints)
          Adds the specified component to the layout, with the specified constraints object.
 void addLayoutComponent(java.lang.String name, Component component)
          Adds the specified component to the layout group.
protected  void adjustForGravity(GridBagConstraints gbc, Rectangle rect)
           
protected  void AdjustForGravity(GridBagConstraints gbc, Rectangle rect)
          Obsolete.
protected  void arrangeGrid(Container parent)
           
protected  void ArrangeGrid(Container parent)
          Obsolete.
private  void calcCellSizes(int[] sizes, double[] weights, int range)
          Helper method used by GetLayoutInfo to distribute extra space based on weight distribution.
private  void calcCellWeights(double weight, double[] weights, int start, int span)
          Helper method used by GetLayoutInfo to calculate weight distribution.
private  void distributeSizeAndWeight(int size, double weight, int start, int span, int[] sizes, double[] weights)
          Helper method used by GetLayoutInfo to distribute a component's size and weight.
private  void dumpArray(double[] array)
           
private  void dumpArray(int[] array)
           
private  void dumpLayoutInfo(GridBagLayoutInfo info)
           
 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  GridBagLayoutInfo getLayoutInfo(Container parent, int sizeflag)
           
protected  GridBagLayoutInfo GetLayoutInfo(Container parent, int sizeflag)
          Obsolete.
 Point getLayoutOrigin()
           
 double[][] getLayoutWeights()
           
protected  Dimension getMinSize(Container parent, GridBagLayoutInfo info)
           
protected  Dimension GetMinSize(Container parent, 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)
           
private  GridBagConstraints lookupInternalConstraints(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)
           
private  void sortBySpan(Component component, int span, java.util.ArrayList list, boolean sortByWidth)
          Helper method used by GetLayoutInfo to keep components sorted, either by gridwidth or gridheight.
private  double sumDoubleArray(double[] array)
          Helper method to calc the sum of all elements in an double array.
private  int sumIntArray(int[] array)
          Helper method to calc the sum of all elements in an int array.
private  int sumIntArray(int[] array, int upto)
          Helper method to calc the sum of a range of elements in an int array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

MINSIZE

protected static final int MINSIZE
See Also:
Constant Field Values

PREFERREDSIZE

protected static final int PREFERREDSIZE
See Also:
Constant Field Values

MAXGRIDSIZE

protected static final int MAXGRIDSIZE
See Also:
Constant Field Values

comptable

protected java.util.Hashtable comptable

internalcomptable

private java.util.Hashtable internalcomptable

layoutInfo

protected GridBagLayoutInfo layoutInfo

defaultConstraints

protected GridBagConstraints defaultConstraints

columnWeights

public double[] columnWeights

columnWidths

public int[] columnWidths

rowWeights

public double[] rowWeights

rowHeights

public int[] rowHeights
Constructor Detail

GridBagLayout

public GridBagLayout()
Method Detail

sumIntArray

private int sumIntArray(int[] array,
                        int upto)
Helper method to calc the sum of a range of elements in an int array.


sumIntArray

private int sumIntArray(int[] array)
Helper method to calc the sum of all elements in an int array.


sumDoubleArray

private double sumDoubleArray(double[] array)
Helper method to calc the sum of all elements in an double array.


addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               Component component)
Description copied from interface: LayoutManager
Adds the specified component to the layout group.

Specified by:
addLayoutComponent in interface LayoutManager

removeLayoutComponent

public void removeLayoutComponent(Component component)
Description copied from interface: LayoutManager
Removes the specified component from the layout group.

Specified by:
removeLayoutComponent in interface LayoutManager

addLayoutComponent

public void addLayoutComponent(Component component,
                               java.lang.Object constraints)
Description copied from interface: LayoutManager2
Adds the specified component to the layout, with the specified constraints object.

Specified by:
addLayoutComponent in interface LayoutManager2

preferredLayoutSize

public Dimension preferredLayoutSize(Container parent)
Description copied from interface: LayoutManager
Calculates the preferred size for this container, taking into account the components it contains.

Specified by:
preferredLayoutSize in interface LayoutManager

minimumLayoutSize

public Dimension minimumLayoutSize(Container parent)
Description copied from interface: LayoutManager
Calculates the minimum size for this container, taking into account the components it contains.

Specified by:
minimumLayoutSize in interface LayoutManager

maximumLayoutSize

public Dimension maximumLayoutSize(Container target)
Description copied from interface: LayoutManager2
Determines the maximum size of the specified target container.

Specified by:
maximumLayoutSize in interface LayoutManager2

layoutContainer

public void layoutContainer(Container parent)
Description copied from interface: LayoutManager
Lays out the components in the given container.

Specified by:
layoutContainer in interface LayoutManager

getLayoutAlignmentX

public float getLayoutAlignmentX(Container target)
Description copied from interface: LayoutManager2
Returns the preferred X axis alignment for the specified target container. This value will range from 0 to 1 where 0 is alignment closest to the origin, 0.5 is centered, and 1 is aligned furthest from the origin.

Specified by:
getLayoutAlignmentX in interface LayoutManager2

getLayoutAlignmentY

public float getLayoutAlignmentY(Container target)
Description copied from interface: LayoutManager2
Returns the preferred Y axis alignment for the specified target container. This value will range from 0 to 1 where 0 is alignment closest to the origin, 0.5 is centered, and 1 is aligned furthest from the origin.

Specified by:
getLayoutAlignmentY in interface LayoutManager2

invalidateLayout

public void invalidateLayout(Container target)
Description copied from interface: LayoutManager2
Forces the layout manager to purge any cached information about the layout of the target container. This will force it to be recalculated.

Specified by:
invalidateLayout in interface LayoutManager2

setConstraints

public void setConstraints(Component component,
                           GridBagConstraints constraints)

getConstraints

public GridBagConstraints getConstraints(Component component)

lookupConstraints

protected GridBagConstraints lookupConstraints(Component component)

lookupInternalConstraints

private GridBagConstraints lookupInternalConstraints(Component component)

getLayoutOrigin

public Point getLayoutOrigin()
Since:
1.1

getLayoutDimensions

public int[][] getLayoutDimensions()
Since:
1.1

getLayoutWeights

public double[][] getLayoutWeights()

location

public Point location(int x,
                      int y)
Since:
1.1

AdjustForGravity

protected void AdjustForGravity(GridBagConstraints gbc,
                                Rectangle rect)
                         throws gnu.classpath.NotImplementedException
Obsolete.


ArrangeGrid

protected void ArrangeGrid(Container parent)
Obsolete.


GetLayoutInfo

protected GridBagLayoutInfo GetLayoutInfo(Container parent,
                                          int sizeflag)
Obsolete.


GetMinSize

protected Dimension GetMinSize(Container parent,
                               GridBagLayoutInfo info)
Obsolete.


getMinSize

protected Dimension getMinSize(Container parent,
                               GridBagLayoutInfo info)
Since:
1.4

sortBySpan

private void sortBySpan(Component component,
                        int span,
                        java.util.ArrayList list,
                        boolean sortByWidth)
Helper method used by GetLayoutInfo to keep components sorted, either by gridwidth or gridheight.


distributeSizeAndWeight

private void distributeSizeAndWeight(int size,
                                     double weight,
                                     int start,
                                     int span,
                                     int[] sizes,
                                     double[] weights)
Helper method used by GetLayoutInfo to distribute a component's size and weight.


calcCellWeights

private void calcCellWeights(double weight,
                             double[] weights,
                             int start,
                             int span)
Helper method used by GetLayoutInfo to calculate weight distribution.


calcCellSizes

private void calcCellSizes(int[] sizes,
                           double[] weights,
                           int range)
Helper method used by GetLayoutInfo to distribute extra space based on weight distribution.


dumpLayoutInfo

private void dumpLayoutInfo(GridBagLayoutInfo info)

dumpArray

private void dumpArray(int[] array)

dumpArray

private void dumpArray(double[] array)

arrangeGrid

protected void arrangeGrid(Container parent)
Since:
1.4

getLayoutInfo

protected GridBagLayoutInfo getLayoutInfo(Container parent,
                                          int sizeflag)
Since:
1.4

adjustForGravity

protected void adjustForGravity(GridBagConstraints gbc,
                                Rectangle rect)
Since:
1.4