Component Preferred, Minimum, and Maximum Sizes

Components can specify their preferred, minimum, and maximum sizes by overriding getPreferredSize(), getMinimumSize() and getMaximumSize(), respectively.

It is important to emphasize, however, that overriding the methods listed above does not guarantee anything about a component's size. The methods are merely guidelines that may well be ignored by the objects that size components—layout managers. Layout managers and component preferred sizes are discussed in “Components, Containers, and Layout Managers”.

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.