8.8.2 Using Flow Layout

Flow Layout is the default layout manager for every JPanel. It simply lays out components from left to right, starting new rows if necessary.

 

 

Using Bean Builder, the Components can be placed directly to the Container or moved around to change the position. The Vertical and Horizontal Gap can be specified using the Layout Properties Dialog.

 

How to use it

 

 

Resizing in FlowLayout

 

The components can be directly resized by dragging it using mouse and also by setting bounds in property sheet. Components can be resized to its minimum size and not below it. If the bounds set are less than the minimum size it reverts back to its minimum size.

 

FlowLayout properties

 

The layoutProperties in FlowLayout allows us to set the HGap , VGap and alignment properties.

 

Aligning Beans in FlowLayout

 

The beans in this layout are aligned one after the other in a sequential order. The alignment and spacing properties like RightAlign, Leftalign, TopAlign, VerticalSpacing, etc. are not applicable for this layout. Therefore in this layout, only two options are enabled when you right click on the multiple selected beans. They are Same Width and Same Height. Using these options you can you can fix the same width or height for a set of beans.



Copyright © 2011 ZOHO Corp. All Rights Reserved.