Using FlowLayout

The FlowLayout layout manager arranges components in a left-to-right flow, with wrapping lines. The advantages of the flow layout manager include its ease of use, and the guarantee that each component can be seen.

About this task

The FlowLayout layout manager (java.awt.FlowLayout) dynamically sizes each component according to its preferred size. It positions components so that they are evenly spaced. Flow layouts are typically used to arrange buttons in a panel. It arranges buttons left to right until no more buttons fit on the same line. Each line is centered by default, unless alignment is set to left or right.

FlowLayout is the default layout manager for a JPanel.

Procedure


Feedback