22.9 BoxLayout Layout Manager
In Chapter 12, we introduced three layout managers—FlowLayout
, BorderLayout
and GridLayout
. This section and Section 22.10 present two additional layout managers (summarized in Fig. 22.15). We discuss them in the examples that follow.
The BoxLayout
layout manager (in package javax.swing
) arranges GUI components horizontally along a container’s x-axis or vertically along its y-axis. The application in Figs. 22.16–22.17 demonstrate BoxLayout
and the container class Box
that uses BoxLayout
as its default layout manager.
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.