| java.lang.Object org.eclipse.swt.widgets.Layout org.eclipse.swt.layout.GridLayout
GridLayout | final public class GridLayout extends Layout (Code) | | Instances of this class lay out the control children of a
Composite in a grid.
GridLayout has a number of configuration fields, and the
controls it lays out can have an associated layout data object, called
GridData . The power of GridLayout lies in the
ability to configure GridData for each control in the layout.
The following code creates a shell managed by a GridLayout
with 3 columns:
Display display = new Display();
Shell shell = new Shell(display);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
shell.setLayout(gridLayout);
The numColumns field is the most important field in a
GridLayout . Widgets are laid out in columns from left
to right, and a new row is created when numColumns + 1
controls are added to the Composite.
See Also: GridData |
Field Summary | |
public int | horizontalSpacing horizontalSpacing specifies the number of pixels between the right
edge of one cell and the left edge of its neighbouring cell to
the right. | public boolean | makeColumnsEqualWidth makeColumnsEqualWidth specifies whether all columns in the layout
will be forced to have the same width. | public int | marginBottom marginBottom specifies the number of pixels of vertical margin
that will be placed along the bottom edge of the layout. | public int | marginHeight marginHeight specifies the number of pixels of vertical margin
that will be placed along the top and bottom edges of the layout. | public int | marginLeft marginLeft specifies the number of pixels of horizontal margin
that will be placed along the left edge of the layout. | public int | marginRight marginRight specifies the number of pixels of horizontal margin
that will be placed along the right edge of the layout. | public int | marginTop marginTop specifies the number of pixels of vertical margin
that will be placed along the top edge of the layout. | public int | marginWidth marginWidth specifies the number of pixels of horizontal margin
that will be placed along the left and right edges of the layout. | public int | numColumns numColumns specifies the number of cell columns in the layout. | public int | verticalSpacing verticalSpacing specifies the number of pixels between the bottom
edge of one cell and the top edge of its neighbouring cell underneath. |
Constructor Summary | |
public | GridLayout() Constructs a new instance of this class. | public | GridLayout(int numColumns, boolean makeColumnsEqualWidth) Constructs a new instance of this class given the
number of columns, and whether or not the columns
should be forced to have the same width. |
Method Summary | |
protected Point | computeSize(Composite composite, int wHint, int hHint, boolean flushCache) | protected boolean | flushCache(Control control) | GridData | getData(Control[][] grid, int row, int column, int rowCount, int columnCount, boolean first) | String | getName() | protected void | layout(Composite composite, boolean flushCache) | Point | layout(Composite composite, boolean move, int x, int y, int width, int height, boolean flushCache) | public String | toString() Returns a string containing a concise, human-readable
description of the receiver. |
horizontalSpacing | public int horizontalSpacing(Code) | | horizontalSpacing specifies the number of pixels between the right
edge of one cell and the left edge of its neighbouring cell to
the right.
The default value is 5.
|
makeColumnsEqualWidth | public boolean makeColumnsEqualWidth(Code) | | makeColumnsEqualWidth specifies whether all columns in the layout
will be forced to have the same width.
The default value is false.
|
marginBottom | public int marginBottom(Code) | | marginBottom specifies the number of pixels of vertical margin
that will be placed along the bottom edge of the layout.
The default value is 0.
since: 3.1 |
marginHeight | public int marginHeight(Code) | | marginHeight specifies the number of pixels of vertical margin
that will be placed along the top and bottom edges of the layout.
The default value is 5.
|
marginLeft | public int marginLeft(Code) | | marginLeft specifies the number of pixels of horizontal margin
that will be placed along the left edge of the layout.
The default value is 0.
since: 3.1 |
marginRight | public int marginRight(Code) | | marginRight specifies the number of pixels of horizontal margin
that will be placed along the right edge of the layout.
The default value is 0.
since: 3.1 |
marginTop | public int marginTop(Code) | | marginTop specifies the number of pixels of vertical margin
that will be placed along the top edge of the layout.
The default value is 0.
since: 3.1 |
marginWidth | public int marginWidth(Code) | | marginWidth specifies the number of pixels of horizontal margin
that will be placed along the left and right edges of the layout.
The default value is 5.
|
numColumns | public int numColumns(Code) | | numColumns specifies the number of cell columns in the layout.
If numColumns has a value less than 1, the layout will not
set the size and position of any controls.
The default value is 1.
|
verticalSpacing | public int verticalSpacing(Code) | | verticalSpacing specifies the number of pixels between the bottom
edge of one cell and the top edge of its neighbouring cell underneath.
The default value is 5.
|
GridLayout | public GridLayout()(Code) | | Constructs a new instance of this class.
|
GridLayout | public GridLayout(int numColumns, boolean makeColumnsEqualWidth)(Code) | | Constructs a new instance of this class given the
number of columns, and whether or not the columns
should be forced to have the same width.
If numColumns has a value less than 1, the layout will not
set the size and position of any controls.
Parameters: numColumns - the number of columns in the grid Parameters: makeColumnsEqualWidth - whether or not the columns will have equal width since: 2.0 |
computeSize | protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache)(Code) | | |
getData | GridData getData(Control[][] grid, int row, int column, int rowCount, int columnCount, boolean first)(Code) | | |
layout | Point layout(Composite composite, boolean move, int x, int y, int width, int height, boolean flushCache)(Code) | | |
toString | public String toString()(Code) | | Returns a string containing a concise, human-readable
description of the receiver.
a string representation of the layout |
|
|