Contents
|
|
FormLayout (JGoodies)
FormLayout is a powerful,
flexible and precise general purpose
layout manager. It places
components in a grid of columns
and rows, allowing specified components to span multiple columns or
rows. Not all columns/rows necessarily have the same width/height.
Unlike other grid-based layout
managers, FormLayout uses 1-based
column/row indices. And it uses "real" columns/rows as gaps. Therefore
the unusual column/row numbers in the above screenshot. Using gap
columns/rows has the advantage that you can give gaps different sizes.
Use the column and row headers
to insert or delete columns/rows and change column/row properties.
JFormDesigner automatically adds/removes gap columns if you add/remove
a column/row.
Compared to other layout managers, FormLayout provides following
outstanding features:
- Default alignment of components in a column/row.
- Specification of minimum and maximum column width or row height.
- Supports different units: Dialog units, Pixel, Point, Millimeter,
Centimeter and Inch. Especially Dialog units are very useful to create
layouts that scale with the screen resolution.
- Column/row templates.
- Column/row grouping.
FormLayout is open source and not
part of the standard Java
distribution. You must ship an additional library with your
application. JFormDesigner includes forms.jar, forms-javadoc.zip
and forms-src.zip
in its redist folder. For more documentation and
tutorials,
visit forms.dev.java.net.
IDE plug-ins: If you use FormLayout the first
time, the JFormDesigner IDE plug-in ask you whether it should copy the
required library (and its source code and documentation) to the IDE
project and add it to the classpath of the IDE project.
Layout properties
A
container with this layout manager has following layout
properties:
| columnSpecs |
Comma
separated encoded column
specifications. This property is for experts only. Use the column header instead of
editing this property. |
| rowSpecs |
Comma
separated encoded row
specifications. This property is for experts only. Use the row headers instead of editing
this property. |
Column/row properties
Each column and row has its own
properties. Use the column and row headers
to change column/row
properties.

| Column/Row |
The
index of the column/row. Use
the arrow buttons (or Alt+Left, Alt+Right,
Alt+Up, Alt+Down
keys) to
edit the properties of the previous or next column/row. |
| Template |
FormLayout
provides several predefined
templates
for
columns and rows. Here you can choose one. |
| Specification |
The
column/row specification. This
is a string representation of the options below. |
| Default alignment |
The
default alignment of the
components within a column/row. Used if the value of the component
constraint properties "h align" or "v align" are set to DEFAULT. |
| Size |
The
width of a column or
height of a row. You can use default, preferred or minimum component
size. Or a constant size. It is also possible to specify a minimum and
a maximum size. Note that the maximum size does not limit the
column/row size if the column/row can grow (see resize behavior). |
| Resize
behavior |
The
resize weight of the
column/row. |
| Grouping |
See column/row
grouping for details. |
Tip:
The column/row context menu allows you to alter many of
these options for multi-selections.
Constraints properties
A component contained in a
container with this layout manager has
following constraints
properties:
| grid x |
Specifies
the component's
horizontal grid origin (column index). |
| grid y |
Specifies
the component's vertical
grid origin (row index). |
| grid width |
Specifies
the component's
horizontal grid extend (number of columns). Default is 1. |
| grid
height |
Specifies
the component's vertical
grid extend (number of rows). Default is 1. |
| h align |
The
horizontal alignment of the
component within its cell. Possible values: DEFAULT, LEFT, CENTER,
RIGHT and
FILL. Default is DEFAULT. |
| v align |
The
vertical alignment of the
component within its cell. Possible values: DEFAULT, TOP, CENTER,
BOTTOM and
FILL. Default is DEFAULT. |
| insets |
Specifies
the external padding of the component, the minimum amount of space
between the component and the edges of its display area. Default is
[0,0,0,0].
Note that the insets do not increase the column width or row height (in
contrast to the GridBagConstraints.insets). |
Tip:
The component context menu allows you to alter the alignment for
multi-selections.
« previous | next »
|