Null Layout Managers

Upon hearing of layout managers, newcomers to the AWT often have an overwhelming compulsion to simply set their container's layout manager to null and explicitly position and size the components displayed in their container.

Almost without exception, such a strategy is ill-fated. A container with a null layout manager will not be able to cope with resize events. As soon as this discovery is made, the next step is to override paint() to reposition and reshape the components laid out in the container. Once things have degenerated to this point, all of the benefits of the strategy pattern[14] go down the tubes. The algorithm for laying out components becomes hardcoded in the container, and therefore the container cannot easily ...

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.