Layout Managers

Before you begin writing a Swing program, there is one more thing that you need to be aware of: the layout manager. The layout manager controls the position of components within a container. Java offers several layout managers. Most are provided by the AWT (within java.awt), but Swing adds a few of its own. All layout managers are instances of a class that implements the LayoutManager interface. (Some will also implement the LayoutManager2 interface.) Here is a list of a few of the layout managers available to the Swing programmer:

Image

Frankly, the topic of layout managers is quite large, and it is not possible to examine it in detail ...

Get Java, A Beginner's Guide, 5th Edition, 5th 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.