Standard AWT Layout Managers

The AWT comes with five standard layout managers, as shown in Table 10-4.

The designers of the AWT hit a home run with the implementation of layout management and event handling by employing the strategy pattern for each.[8] Containers are not responsible for laying out their own components; they delegate that responsibility to a layout manager. By encapsulating the algorithm for laying out components in a separate class, the layout functionality is available for others to use (and extend), while containers may be fitted with different layout managers at runtime. The same benefits apply for the delegation-based event model. The AWT designers also did a decent job of providing a set of default layout managers, which ...

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.