- 2 minutes to read
For groups nested within the root group, you can enable flow layout mode, in which layout items are arranged back-to-back, automatically wrapping at the group's right edge.
Flow Layout Features
FlowLayout is the simplest layout in Java Swing layouts. The FlowLayout places components from left to right in a row using preferred component sizes until no space is available in the container. When no space is available, a new row is started. The placement of the component depends on the size of the container, therefore, you cannot guarantee. FlowLayout is doing what it suggests, flowing components left to right till it has no space and then goes on next line, with different layouts you can do what you need. – AbstractChaos Nov 22 '12 at 10:30.
In flow layout mode, layout items are arranged back-to-back in rows, and are automatically wrapped at the group's right edge. So, when the group width is changed, item positions within the flow layout are updated, as shown in the following animation.
You can force any item to start a new row by setting its BaseLayoutItem.StartNewLine property to true.
To change the default left-to-right item layout, modify the LayoutGroup.FlowDirection setting.
Enabling Flow Layout Mode
Flow layout mode can be enabled for groups nested within the root group (LayoutControl.Root) using the LayoutGroup.LayoutMode property. This mode cannot be enabled for the root group itself.
At design time, you can enable flow layout mode from the Customization Menu. Right-click a layout group and select the Convert To -> Flow Layout action.
Flow layout cannot be enabled for a layout group if it contains nested groups.
Flow Layout Customization
A flow layout is fully customizable at design time and runtime using drag and drop functionality, resizing operations and additional customization commands available from the context menu.Item size constraints may restrict sizing operations. To learn more, see Size and Alignment.
The drag and drop functionality allows you to add new items to the layout group and rearrange existing items.
Flow and Regular Mode Comparison
|Characteristic||Flow Layout Mode||Regular Layout Mode|
|Item Arrangement||Layout items are arranged in rows. The item flow automatically wraps at the group's right edge.||Layout items are stretched within the parent layout group. Empty Space Items can be helpful in preventing item stretching.|
|Item Resizing when LayoutControl is Resized||Layout items are not resized, but the flow of items automatically wraps at the parent group's right edge.||Layout items are automatically resized according to their size constraints.|
|Nested Groups||Not supported.||Supported.|