Eclipse Platform
2.0

org.eclipse.swt.layout
Class GridData

java.lang.Object
  |
  +--org.eclipse.swt.layout.GridData

public final class GridData
extends Object

GridData is the layout data object associated with GridLayout. To set a GridData object into a control, you use the setLayoutData () method.

There are two ways to create a GridData object with certain fields set. The first is to set the fields directly, like this:

 		GridData gridData = new GridData();
 		gridData.horizontalAlignment = GridData.FILL;
 		gridData.grabExcessHorizontalSpace = true;
 		button1.setLayoutData(gridData);
 
The second is to take advantage of convenience style bits defined by GridData:
      button1.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
 

NOTE: Do not reuse GridData objects. Every control in a Composite that is managed by a GridLayout must have a unique GridData object. If the layout data for a control in a GridLayout is null at layout time, a unique GridData object is created for it.

See Also:
GridLayout

Field Summary
static int BEGINNING
           
static int CENTER
           
static int END
           
static int FILL
           
static int FILL_BOTH
          FILL_BOTH = FILL_VERTICAL | FILL_HORIZONTAL
static int FILL_HORIZONTAL
          FILL_HORIZONTAL = HORIZONTAL_ALIGN_FILL | GRAB_HORIZONTAL
static int FILL_VERTICAL
          FILL_VERTICAL = VERTICAL_ALIGN_FILL | GRAB_VERTICAL
static int GRAB_HORIZONTAL
           
static int GRAB_VERTICAL
           
 boolean grabExcessHorizontalSpace
          grabExcessHorizontalSpace specifies whether the cell will be made wide enough to fit the remaining horizontal space.
 boolean grabExcessVerticalSpace
          grabExcessVerticalSpace specifies whether the cell will be made tall enough to fit the remaining vertical space.
 int heightHint
          heightHint specifies a minimum height for the row.
static int HORIZONTAL_ALIGN_BEGINNING
           
static int HORIZONTAL_ALIGN_CENTER
           
static int HORIZONTAL_ALIGN_END
           
static int HORIZONTAL_ALIGN_FILL
           
 int horizontalAlignment
          horizontalAlignment specifies how controls will be positioned horizontally within a cell.
 int horizontalIndent
          horizontalIndent specifies the number of pixels of indentation that will be placed along the left side of the cell.
 int horizontalSpan
          horizontalSpan specifies the number of column cells that the control will take up.
static int VERTICAL_ALIGN_BEGINNING
           
static int VERTICAL_ALIGN_CENTER
           
static int VERTICAL_ALIGN_END
           
static int VERTICAL_ALIGN_FILL
           
 int verticalAlignment
          verticalAlignment specifies how controls will be positioned vertically within a cell.
 int verticalSpan
          verticalSpan specifies the number of row cells that the control will take up.
 int widthHint
          widthHint specifies a minimum width for the column.
 
Constructor Summary
GridData()
           
GridData(int style)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

verticalAlignment

public int verticalAlignment
verticalAlignment specifies how controls will be positioned vertically within a cell. The default value is CENTER. Possible values are: BEGINNING: Position the control at the top of the cell CENTER: Position the control in the vertical center of the cell END: Position the control at the bottom of the cell FILL: Resize the control to fill the cell vertically


horizontalAlignment

public int horizontalAlignment
horizontalAlignment specifies how controls will be positioned horizontally within a cell. The default value is BEGINNING. Possible values are: BEGINNING: Position the control at the left of the cell CENTER: Position the control in the horizontal center of the cell END: Position the control at the right of the cell FILL: Resize the control to fill the cell horizontally


widthHint

public int widthHint
widthHint specifies a minimum width for the column. A value of SWT.DEFAULT indicates that no minimum width is specified. The default value is SWT.DEFAULT.


heightHint

public int heightHint
heightHint specifies a minimum height for the row. A value of SWT.DEFAULT indicates that no minimum height is specified. The default value is SWT.DEFAULT.


horizontalIndent

public int horizontalIndent
horizontalIndent specifies the number of pixels of indentation that will be placed along the left side of the cell. The default value is 0.


horizontalSpan

public int horizontalSpan
horizontalSpan specifies the number of column cells that the control will take up. The default value is 1.


verticalSpan

public int verticalSpan
verticalSpan specifies the number of row cells that the control will take up. The default value is 1.


grabExcessHorizontalSpace

public boolean grabExcessHorizontalSpace
grabExcessHorizontalSpace specifies whether the cell will be made wide enough to fit the remaining horizontal space. The default value is false.


grabExcessVerticalSpace

public boolean grabExcessVerticalSpace
grabExcessVerticalSpace specifies whether the cell will be made tall enough to fit the remaining vertical space. The default value is false.


BEGINNING

public static final int BEGINNING
See Also:
Constant Field Values

CENTER

public static final int CENTER
See Also:
Constant Field Values

END

public static final int END
See Also:
Constant Field Values

FILL

public static final int FILL
See Also:
Constant Field Values

VERTICAL_ALIGN_BEGINNING

public static final int VERTICAL_ALIGN_BEGINNING
See Also:
Constant Field Values

VERTICAL_ALIGN_CENTER

public static final int VERTICAL_ALIGN_CENTER
See Also:
Constant Field Values

VERTICAL_ALIGN_END

public static final int VERTICAL_ALIGN_END
See Also:
Constant Field Values

VERTICAL_ALIGN_FILL

public static final int VERTICAL_ALIGN_FILL
See Also:
Constant Field Values

HORIZONTAL_ALIGN_BEGINNING

public static final int HORIZONTAL_ALIGN_BEGINNING
See Also:
Constant Field Values

HORIZONTAL_ALIGN_CENTER

public static final int HORIZONTAL_ALIGN_CENTER
See Also:
Constant Field Values

HORIZONTAL_ALIGN_END

public static final int HORIZONTAL_ALIGN_END
See Also:
Constant Field Values

HORIZONTAL_ALIGN_FILL

public static final int HORIZONTAL_ALIGN_FILL
See Also:
Constant Field Values

GRAB_HORIZONTAL

public static final int GRAB_HORIZONTAL
See Also:
Constant Field Values

GRAB_VERTICAL

public static final int GRAB_VERTICAL
See Also:
Constant Field Values

FILL_VERTICAL

public static final int FILL_VERTICAL
FILL_VERTICAL = VERTICAL_ALIGN_FILL | GRAB_VERTICAL

See Also:
Constant Field Values

FILL_HORIZONTAL

public static final int FILL_HORIZONTAL
FILL_HORIZONTAL = HORIZONTAL_ALIGN_FILL | GRAB_HORIZONTAL

See Also:
Constant Field Values

FILL_BOTH

public static final int FILL_BOTH
FILL_BOTH = FILL_VERTICAL | FILL_HORIZONTAL

See Also:
Constant Field Values
Constructor Detail

GridData

public GridData()

GridData

public GridData(int style)

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.