12.8. Effective Use of Layout Managers

The idea of a layout manager is a good one. In principle, a layout manager relieves the developer of the requirement to specify the sizes and positions of each and every component and simplifies the development of many interfaces. In practice, however, many developers feel that the layout managers are hindering them more than helping them. Although some layout managers such as GridBagLayout require more effort than they should, a few basic strategies for harnessing the power of layout managers will significantly simplify the UI layout process.

Use nested containers. No law states that you have to use a single layout manager for everything. Divide and conquer!

Turn off the layout manager for some containers. ...

Get Core Web Programming, Second 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.