Home Segments Top Top Previous Next

732: Sidetrip

Many programmers avoid defining getMinimumSize and getPreferredSize methods on the ground that layout managers should be smart enough to do a good job without advice, and that providing advice, in the form of definitions for getMinimumSize and getPreferredSize methods, robs the layout manager of potentially useful flexibility.

Other programmers believe that, without a bit of meddling, layout managers act too mysteriously. In this book, we meddle, having found in developing the examples that we need getMinimumSize and getPreferredSize to ensure that certain components, in certain positions, will appear.