17 Working with Layout

17.1 LAYOUT AND LAYOUT MANAGER

A layout manager automatically arranges the controls within a window by using some types of algorithm. In Java LayoutManager is an interface for classes that know how to lay out Containers. A layout manager is an instance of any class that implements the LayoutManager interface.

The sizes and positions of the components in a container are usually controlled by a layout manager. Different layout managers implement different ways of arranging components. There are several predefined layout manager classes in the AWT: FlowLayout, GridLayout, BorderLayout, CardLayout and GridBagLayout. It is also possible to define new layout managers, if none of these suit one's purpose. Every container is ...

Get Java Programming 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.