Summary

Containers in the AWT delegate positioning and shaping the components they contain to a layout manager. The AWT provides a set of five layout managers that are sufficient for most layout needs.

The tricky part about using the standard AWT layout managers is knowing when to use which one, but there are a few tips that can help until you've gained enough practice and experience that the decision is second nature.

The standard layout managers are fairly comprehensive in terms of the number of ways they can arrange components in a display. However, for those occasions when they just don't provide the desired behavior, you can implement your own implementation of the LayoutManager (or LayoutManager2) interface and create your own custom layout ...

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.