is new.
java.lang.Objectjavax.swing.SizeRequirements
public class SizeRequirements
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 TM has been added to the java.beans package. Please see XMLEncoder .
| Field Summary | |
|---|---|
| float |
alignment
The alignment, specified as a value between 0.0 and 1.0, inclusive. |
| int |
maximum
The maximum size allowed. |
| int |
minimum
The minimum size required. |
| int |
preferred
The preferred (natural) size. |
| Constructor Summary | |
|---|---|
|
SizeRequirements
() Creates a SizeRequirements object with the minimum, preferred, and maximum sizes set to zero and an alignment value of 0.5 (centered). |
|
|
SizeRequirements
(int min, int pref, int max, float a) Creates a SizeRequirements object with the specified minimum, preferred, and maximum sizes and the specified alignment. |
|
| Method Summary | |
|---|---|
| static int[] |
adjustSizes
(int delta,
SizeRequirements
[] children) Adjust a specified array of sizes by a given amount. |
| static void |
calculateAlignedPositions
(int allocated,
SizeRequirements
total,
SizeRequirements
[] children, int[] offsets, int[] spans) Creates a bunch of offset/span pairs specifying how to lay out a set of components with the specified alignments. |
| static void |
calculateAlignedPositions
(int allocated,
SizeRequirements
total,
SizeRequirements
[] children, int[] offsets, int[] spans, boolean normal) Creates a set of offset/span pairs specifying how to lay out a set of components with the specified alignments. |
| static void |
calculateTiledPositions
(int allocated,
SizeRequirements
total,
SizeRequirements
[] children, int[] offsets, int[] spans) Creates a set of offset/span pairs representing how to lay out a set of components end-to-end. |
| static void |
calculateTiledPositions
(int allocated,
SizeRequirements
total,
SizeRequirements
[] children, int[] offsets, int[] spans, boolean forward) Creates a set of offset/span pairs representing how to lay out a set of components end-to-end. |
| static SizeRequirements |
getAlignedSizeRequirements
(
SizeRequirements
[] children) Determines the total space necessary to align a set of components. |
| static SizeRequirements |
getTiledSizeRequirements
(
SizeRequirements
[] children) Determines the total space necessary to place a set of components end-to-end. |
| String |
toString
() Returns a string describing the minimum, preferred, and maximum size requirements, along with the alignment. |
| Methods inherited from class java.lang. Object |
|---|
| clone , equals , finalize , getClass , hashCode , notify , notifyAll , wait , wait , wait |
| Field Detail |
|---|
public int minimum
public int preferred
public int maximum
public float alignment
| Constructor Detail |
|---|
public SizeRequirements()
public SizeRequirements(int min,
int pref,
int max,
float a)
| Method Detail |
|---|
public String toString()
public static SizeRequirements getTiledSizeRequirements(SizeRequirements[] children)
public static SizeRequirements getAlignedSizeRequirements(SizeRequirements[] children)
public static void calculateTiledPositions(int allocated,
SizeRequirements total,
SizeRequirements[] children,
int[] offsets,
int[] spans)
public static void calculateTiledPositions(int allocated,
SizeRequirements total,
SizeRequirements[] children,
int[] offsets,
int[] spans,
boolean forward)
Since:
1.4
public static void calculateAlignedPositions(int allocated,
SizeRequirements total,
SizeRequirements[] children,
int[] offsets,
int[] spans)
public static void calculateAlignedPositions(int allocated,
SizeRequirements total,
SizeRequirements[] children,
int[] offsets,
int[] spans,
boolean normal)
Since:
1.4
public static int[] adjustSizes(int delta,
SizeRequirements[] children)