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.

Image

Fig. 22.15 | Additional layout managers.

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.1622.17 demonstrate BoxLayout and the container class Box that uses BoxLayout as its default layout manager.

 1   // Fig. 22.16: BoxLayoutFrame.java ...

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.