Documentation

Contents

 

GroupLayout (Free Design)

The goal of the group layout manager is to make it easy to create professional cross platform layouts. It is designed for GUI builders, such as JFormDesigner, to use the "Free Design" paradigm. You can lay out your forms by simply placing components where you want them. Visual guidelines suggest optimal spacing, alignment and resizing of components.

GroupLayout

GroupLayout has been developed by the NetBeans team and is also used by the NetBeans GUI Builder (formerly Project Matisse). They provide a comprehensive tutorial on designing GUIs using GroupLayout, which is also suitable for JFormDesigner: http://www.netbeans.org/kb/60/java/quickstart-gui.html

GroupLayout is part of the standard Java distribution since Java 6. If you need to run your application also on Java 5 or 1.4, you can use the open-source Swing Layout Extension library, which is compatible to the Java 6 GroupLayout, but uses different package names. Change the option "GroupLayout Generation Style" in the Layout Managers (Java Code Generator) preferences if necessary.

IDE plug-ins: If you use GroupLayout from the Swing Layout Extension library the 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.

Alignment guidelines

Alignment guidelines appear only when adding or moving components. They indicate the preferred positions to which components snap when releasing the mouse button.

Insets are the preferred spacings between components and their container.

Inset Guidelines

Offsets are the preferred spacings between adjacent components.

Offset Guidelines

Baseline alignment is the preferred relationship between adjacent components that display text.

Align Baseline Guidelines

Edge alignments (top, bottom, left and right) are possible relationships between adjacent components.

Align Top Guidelines

Align Left Guidelines

Indentation alignment is a special alignment relationship in which one component is located below another and offset slightly to the right.

Indent Guidelines

Anchoring indicators

Anchoring indicators appear when components have snapped into position. They illustrate the alignment and relationship among components.

Anchor Guidelines

Anchors connecting components to their container or to adjacent components are represented by small semi-circular indicators with dashed lines.

Commands

The designer context menu provides following GroupLayout specific commands:

Command Description


Align in column/row Aligns the selected components left/right/top/bottom/center in column/row.

Align Aligns the selected components left/right/top/bottom.

Anchor Changes the anchoring of the selected components. A component is usually horizontally anchored left/right and vertically anchored top/bottom. Anchoring connects a component to a container edge or a neighborhood component edge.

Horizontal Auto Resizing
Makes the selected components resize horizontally at runtime if the container size changes.

Vertical Auto Resizing
Makes the selected components resize vertically at runtime if the container size changes.

Same Width Makes the selected components all the same width. If one of the selected components is already in a group of "Same Width" components, the other components are added to the existing group. To remove components from a group, select them and then execute this command. Grouped components are marked with a small indicator.
Same Width indicators

Same Height Makes the selected components all the same height. See "Save Width" command for more details.

Set Default Size
Makes the selected components have its default size.

Space Around Component Changes the empty space around the selected component.

Layout properties

A container with this layout manager has following layout properties:

Property Name Description
honors visibility Specifies whether component visibility is considered when positioning and sizing components. If true, non-visible components are not treated as part of the layout. If false, components are positioned and sized regardless of visibility. Default is true.

Constraints properties

A component contained in a container with this layout manager has following constraints properties:

Property Name Description
horizontal size Specifies the component's horizontal size in pixel or Default. If set to Default, the component's preferred width is used. Default is Default.
vertical size Specifies the component's vertical size in pixel or Default. If set to Default, the component's preferred height is used. Default is Default.
horizontal resizable Specifies whether the component is horizontal resizable. Default is false.
vertical resizable Specifies whether the component is vertical resizable. Default is false.

« previous | next »