SizeRequirements (Java Platform SE 8 ) (original) (raw)


public class SizeRequirements
extends Object
implements Serializable
For the convenience of layout managers, calculates information about the size and position of components. All size and position calculation methods are class methods that take arrays of SizeRequirements as arguments. The SizeRequirements class supports two types of layout:

tiled

The components are placed end-to-end, starting either at coordinate 0 (the leftmost or topmost position) or at the coordinate representing the end of the allocated span (the rightmost or bottommost position).

aligned

The components are aligned as specified by each component's X or Y alignment value.
Each SizeRequirements object contains information about either the width (and X alignment) or height (and Y alignment) of a single component or a group of components:
minimum

The smallest reasonable width/height of the component or component group, in pixels.

preferred

The natural width/height of the component or component group, in pixels.

maximum

The largest reasonable width/height of the component or component group, in pixels.

alignment

The X/Y alignment of the component or component group.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.
See Also:
Component.getMinimumSize(), Component.getPreferredSize(), Component.getMaximumSize(), Component.getAlignmentX(), Component.getAlignmentY()

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.