17 Working with Layout


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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.