Section 12.18 Introduction to Layout Managers

• Layout managers (p. 528) arrange GUI components in a container for presentation purposes.

• All layout managers implement the interface LayoutManager (p. 528) of package java.awt.

Container method setLayout specifies the layout of a container.

FlowLayout places components left to right in the order in which they’re added to the container. When the container’s edge is reached, components continue to display on the next line. FlowLayout allows GUI components to be left aligned, centered (the default) and right aligned.

FlowLayout method setAlignment (p. 532) changes the alignment for a FlowLayout.

BorderLayout (p. 532) the default for a JFrame) arranges components into five regions: NORTH ...

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.