LayoutManagers

LayoutManager is an interface that defines the following methods:

void        addLayoutComponent     (String name, Component comp)
void        removeLayoutComponent  (String name, Component comp)
Dimension   preferredLayoutSize    (Container parent)
Dimension   minimumLayoutSize      (Container parent)
void        LayoutContainer        (Container parent)

Layout managers are responsible for:

  • Calculating the preferred and minimum sizes for a container

  • Laying out the components contained in a container

It's important to note that while each container has exactly one layout manager, a single layout manager may wind up working for more than one container. Therefore, when a layout manager has to perform some work for a container, it must be passed a reference to the container ...

Get Graphic Java™ 1.2, Volume I: AWT, 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.