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:
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 www.jgoodies.com or forms.java.net.
The API documentation is also available here: doc.formdev.com/jgoodies-forms/.
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.
A container with this layout manager has following layout manager properties:
Property Name | Description |
---|---|
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 header instead of editing this property. |
Each column and row has its own properties. Use the column and row headers to change column/row properties.
![]() |
|
Tip: The column/row context menu allows you to alter many of these options for multi-selections.
A component contained in a container with this layout manager has following layout constraints properties:
Property Name | Description | Default |
---|---|---|
grid x | Specifies the component's horizontal grid origin (column index). | 1 |
grid y | Specifies the component's vertical grid origin (row index). | 1 |
grid width | Specifies the component's horizontal grid extend (number of columns). | 1 |
grid height | Specifies the component's vertical grid extend (number of rows). | 1 |
h align | The horizontal alignment of the component within its cell. Possible values: DEFAULT, LEFT, CENTER, RIGHT and FILL. | DEFAULT |
v align | The vertical alignment of the component within its cell. Possible values: DEFAULT, TOP, CENTER, BOTTOM and FILL. | DEFAULT |
insets | Specifies
the external padding of the component, the minimum amount of space
between the component and the edges of its display area. Note that the insets do not increase the column width or row height (in contrast to the GridBagConstraints.insets). |
0,0,0,0 |
Tip: The component context menu allows you to alter the alignment for multi-selections.