Using Layout Managers
In Java, the placement of components within a container depends on the size of other components and the height and width of the container. The layout of buttons, text fields, and other components can be affected by the following things:
• The size of the container
• The size of other components and containers
• The layout manager that is being used
There are several layout managers you can use to affect how components are shown. The default manager for panels is the FlowLayout class in the java.awt package, which was used during the previous hour.
Under FlowLayout, components are dropped onto an area in the same way words are organized on a page in English—from left to right, and then down to the next line when there’s no ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access