Home » Eclipse-SWT-3.5.1 » org.eclipse.swt.layout » [javadoc | source]
org.eclipse.swt.layout
public final class: GridLayout [javadoc | source]
java.lang.Object
   org.eclipse.swt.widgets.Layout
      org.eclipse.swt.layout.GridLayout
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.

Field Summary
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. The default value is 5. 
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. The default value is 5. 
public  int numColumns    numColumns specifies the number of cell columns in the layout. The default value is 1. 
public  boolean makeColumnsEqualWidth    makeColumnsEqualWidth specifies whether all columns in the layout will be forced to have the same width. The default value is false. 
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. The default value is 5. 
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. The default value is 5. 
 Vector grid     
 int[] pixelColumnWidths     
 int[] pixelRowHeights     
 int[] expandableColumns     
 int[] expandableRows     
Constructor:
 public GridLayout() 
 public GridLayout(int numColumns,
    boolean makeColumnsEqualWidth) 
Method from org.eclipse.swt.layout.GridLayout Summary:
adjustGridDimensions,   calculateGridDimensions,   computeExpandableCells,   computeLayoutSize,   computeSize,   createGrid,   emptyRow,   getCell,   getFirstEmptyCell,   getLastEmptyCell,   layout
Methods from org.eclipse.swt.widgets.Layout:
computeSize,   layout
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.eclipse.swt.layout.GridLayout Detail:
  void adjustGridDimensions(Composite composite,
    boolean flushCache) 
  void calculateGridDimensions(Composite composite,
    boolean flushCache) 
  void computeExpandableCells() 
 Point computeLayoutSize(Composite composite,
    int wHint,
    int hHint,
    boolean flushCache) 
 protected Point computeSize(Composite composite,
    int wHint,
    int hHint,
    boolean flushCache) 
  void createGrid(Composite composite) 
 GridData[] emptyRow() 
 Point getCell(int row,
    int column,
    int width,
    int height) 
 Point getFirstEmptyCell(int row,
    int column) 
 Point getLastEmptyCell(int row,
    int column) 
 protected  void layout(Composite composite,
    boolean flushCache)