<<Previous Next>>
What are
SWT Layouts? Explain the
four standard layouts and one custom layouts provided in
SWT.
SWT Layouts - Jan 19, 2009 at 15:00
PM by Vidya Sagar
What are SWT Layouts?
A layout controls the display / appearance / look of a window. A
layout controls the position of the GUI components.
Explain the four standard layouts and one custom layouts
provided in SWT.
The following are the layouts that are supported in SWT.
FillLayout: It is the simple layout class. It
arranges the widgets in a single row and a column with the same
size. FillLayout can be used to arrange the buttons in a task bar,
tool bar or to stack the checkboxes in a group.
RowLayout: This layout is used instead of
FillLayout. The reason it is having the ability to wrap and provides
the margins and spacing. It has no. of configurable fields and the
height and width of each widget can be specified.
GridLayout: Using this layout, the widgets are
placed / arranged in a grid. It has the features of RowLayout, in
addition to it the widgets can have an associated layout data object
called DataGrid. It is the power of GridLayout that the GridData can
configure and controlled for each widget. The widgets are arranged
in columns from left to right. A new row will be created when the
no. of columns are increased by one than the size of the row.
FormLayout: FormAttachments creation for each
side of the widget, and placing them in the layout data, makes the
working of FormLayout. This layout provides the flexibility while
arranging widgets because it allows to metion the placements of
individual widgets within the layout.
StackLayout: StackLayout places the entire
controls one on top of the another and makes all the controls to
have the same size. The top most control is only visible and others
will be hidden.
|