SWT GridLayout

GridLayout lays 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 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.

Main Features

  • Select GridLayout from the SWT Layouts palette and drop it on a Shell or Composite

  • Graphical feedback is provided for all column, row and cell interactions
  • Cell properties within a column or row may be changed via a popup menu

Popup Header Menu

  • Right-click on the header area to access the popup header menu
      
  • Set the column alignment to left, right, center or fill
  • Specify that the column or row should grab to fill the available space

Graphical Feedback

  • When moving a widget or adding a new widget, open cells are highlighted

      
     
  • Insertion drop point between the current cells will create new columns and rows as needed

      
  • The currently selected cell shows its column and row spanning handles, sizing handles and alignment handles

  • Set the alignment of a cell using its popup alignment menu

  

  • Set the alignment of a cell by dragging within the cell

  • Right-click (or double-click) on a column to set its grab property

  

  • Width and height sizing handles make it easy to set the size of a widget

  

  • Reorder columns and rows by dragging them

  

  • Column and rows borders are indicated with dotted lines

  • Interactive column and row spanning feedback is provided

  

  • Full keyboard support for quickly changing alignment values
l - set horizontal align LEFT
r - set horizontal align RIGHT
c - set horizontal align CENTER
f - set horizontal align FILL
t - set vertical align TOP
b - set vertical align BOTTOM
C - set vertical align CENTER
F - set vertical align FILL
h - switch horizontal grab on/off
v - switch vertical grab on/off
o - set horizontal and vertical alignments to fill and switch horizontal and vertical grab on/off

Cell Editing

  • Floating layout assistant for cells


Preferences & Options

  • Control which editing policy is used
  • Control whether the alignment figures are displayed
  • Control whether SWT 2.x -style code is generated or not

  • Control whether specific widgets automatically grab horizontally or vertically

  

  • Control automatic alignment of labels next to text fields