Package net.miginfocom.layout
Class BoundSize
java.lang.Object
net.miginfocom.layout.BoundSize
- All Implemented Interfaces:
Serializable
A size that contains minimum, preferred and maximum size of type
UnitValue
.
This class is a simple value container and it is immutable.
If a size is missing (i.e., null
) that boundary should be considered "not in use".
You can create a BoundSize from a String with the use of ConstraintParser.parseBoundSize(String, boolean, boolean)
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor that use the same value for min/preferred/max size.Constructor.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionint
constrain
(int size, float refValue, ContainerWrapper parent) Makes sure thatsize
is within min and max of this size.boolean
If the size should be hinted as "pushing" and thus want to occupy free space if noone else is claiming it.final UnitValue
getMax()
Returns the maximum size as sent into the constructor.final UnitValue
getMin()
Returns the minimum size as sent into the constructor.final UnitValue
Returns the preferred size as sent into the constructor.boolean
isUnset()
Returns if this bound size has no min, preferred and maximum size set (they are allnull
)protected Object
-
Field Details
-
NULL_SIZE
-
ZERO_PIXEL
-
-
Constructor Details
-
BoundSize
Constructor that use the same value for min/preferred/max size.- Parameters:
minMaxPref
- The value to use for min/preferred/max size.createString
- The string used to create the BoundsSize.
-
BoundSize
Constructor. This method is here for serilization only and should normally not be used. UseConstraintParser.parseBoundSize(String, boolean, boolean)
instead.- Parameters:
min
- The minimum size. May benull
.preferred
- The preferred size. May benull
.max
- The maximum size. May benull
.createString
- The string used to create the BoundsSize.
-
BoundSize
public BoundSize(UnitValue min, UnitValue preferred, UnitValue max, boolean gapPush, String createString) Constructor. This method is here for serilization only and should normally not be used. UseConstraintParser.parseBoundSize(String, boolean, boolean)
instead.- Parameters:
min
- The minimum size. May benull
.preferred
- The preferred size. May benull
.max
- The maximum size. May benull
.gapPush
- If the size should be hinted as "pushing" and thus want to occupy free space if no one else is claiming it.createString
- The string used to create the BoundsSize.
-
-
Method Details
-
getMin
Returns the minimum size as sent into the constructor.- Returns:
- The minimum size as sent into the constructor. May be
null
.
-
getPreferred
Returns the preferred size as sent into the constructor.- Returns:
- The preferred size as sent into the constructor. May be
null
.
-
getMax
Returns the maximum size as sent into the constructor.- Returns:
- The maximum size as sent into the constructor. May be
null
.
-
getGapPush
public boolean getGapPush()If the size should be hinted as "pushing" and thus want to occupy free space if noone else is claiming it.- Returns:
- The value.
-
isUnset
public boolean isUnset()Returns if this bound size has no min, preferred and maximum size set (they are allnull
)- Returns:
- If unset.
-
constrain
Makes sure thatsize
is within min and max of this size.- Parameters:
size
- The size to constrain.refValue
- The reference to use for relative sizes.parent
- The parent container.- Returns:
- The size, constrained within min and max.
-
readResolve
- Throws:
ObjectStreamException
-