CHAPTER 6

image

Using Layout Managers

In Java, you can use the java.awt.Container class and its subclasses to display groups of Swing components. For example, you might use a JPanel to display a related set of buttons or add components to a JFrame. Layout managers are classes that control the size and location of each component that’s added to a container, and in most cases a layout manager is also responsible for determining the sizes returned from the container’s getMinimumSize(), getPreferredSize(), and getMaximumSize() methods. Layout managers are important because they simplify the task of positioning and sizing components and because they allow ...

Get Pro Java 8 Programming, Third 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.