com.jgoodies.forms.layout
Class ConstantSize
java.lang.Object
com.jgoodies.forms.layout.ConstantSize
- Serializable, Size
public final class ConstantSize
extends java.lang.Object
implements Size, Serializable
An implementation of the
Size
interface that represents constant
sizes described by a value and unit, for example:
10 pixel, 15 point or 4 dialog units.
You can get instances of
ConstantSize
using
the factory methods and constants in the
Sizes
class.
Logical constant sizes that vary with the current layout style
are delivered by the
LayoutStyle
class.
This class supports different size units:
Unit
| Abbreviation |
Size |
Millimeter | mm | 0.1 cm |
Centimeter | cm | 10.0 mm |
Inch | in | 25.4 mm |
DTP Point | pt | 1/72 in |
Pixel | px | 1/(resolution in dpi) in |
Dialog Unit | dlu | honors l&f, resolution, and
dialog font size |
Examples:
Sizes.ZERO;
Sizes.DLUX9;
Sizes.dluX(42);
Sizes.pixel(99);
boolean | equals(Object o) - Indicates whether some other ConstantSize is "equal to" this one.
|
int | getPixelSize(Component component) - Converts the size if necessary and returns the value in pixels.
|
int | hashCode() - Returns a hash code value for the object.
|
int | maximumSize(Container container, List components, com.jgoodies.forms.layout.FormLayout.Measure minMeasure, com.jgoodies.forms.layout.FormLayout.Measure prefMeasure, com.jgoodies.forms.layout.FormLayout.Measure defaultMeasure) - Returns this size as pixel size.
|
String | toString() - Returns a string representation of this size object.
|
equals
public boolean equals(Object o)
Indicates whether some other ConstantSize is "equal to" this one.
o
- the Object with which to compare
true
if this object is the same as the obj
argument; false
otherwise.
java.lang.Object.hashCode()
, java.util.Hashtable
getPixelSize
public int getPixelSize(Component component)
Converts the size if necessary and returns the value in pixels.
component
- the associated component
hashCode
public int hashCode()
Returns a hash code value for the object. This method is
supported for the benefit of hashtables such as those provided by
java.util.Hashtable
.
- a hash code value for this object.
java.lang.Object.equals(java.lang.Object)
, java.util.Hashtable
maximumSize
public int maximumSize(Container container,
List components,
com.jgoodies.forms.layout.FormLayout.Measure minMeasure,
com.jgoodies.forms.layout.FormLayout.Measure prefMeasure,
com.jgoodies.forms.layout.FormLayout.Measure defaultMeasure)
Returns this size as pixel size. Neither requires the component
list nor the specified measures.
Invoked by
FormSpec
to determine
the size of a column or row.
- maximumSize in interface Size
container
- the layout containercomponents
- the list of components used to compute the sizeminMeasure
- the measure that determines the minimum sizesprefMeasure
- the measure that determines the preferred sizesdefaultMeasure
- the measure that determines the default sizes
- the computed maximum size in pixel
toString
public String toString()
Returns a string representation of this size object.
Note: The string representation may change
at any time. It is strongly recommended to not use this string
for parsing purposes.
- a string representation of the constant size
Copyright © 2002-2006 JGoodies Karsten Lentzsch. All Rights Reserved.