|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jgoodies.forms.layout.ConstantSize
public final class ConstantSize
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);
Size,
Sizes,
Serialized Form| Nested Class Summary | |
|---|---|
static class |
ConstantSize.Unit
An ordinal-based serializable typesafe enumeration for units as used in instances of ConstantSize. |
| Field Summary | |
|---|---|
static ConstantSize.Unit |
CENTIMETER
|
static ConstantSize.Unit |
CM
|
static ConstantSize.Unit |
DIALOG_UNITS_X
|
static ConstantSize.Unit |
DIALOG_UNITS_Y
|
static ConstantSize.Unit |
DLUX
|
static ConstantSize.Unit |
DLUY
|
static ConstantSize.Unit |
IN
|
static ConstantSize.Unit |
INCH
|
static ConstantSize.Unit |
MILLIMETER
|
static ConstantSize.Unit |
MM
|
static ConstantSize.Unit |
PIXEL
|
static ConstantSize.Unit |
POINT
|
static ConstantSize.Unit |
PT
|
static ConstantSize.Unit |
PX
|
| Constructor Summary | |
|---|---|
ConstantSize(double value,
ConstantSize.Unit unit)
Constructs a ConstantSize for the given size and unit. |
|
ConstantSize(int value,
ConstantSize.Unit unit)
Constructs a ConstantSize for the given size and unit. |
|
| Method Summary | |
|---|---|
boolean |
compressible()
Describes if this Size can be compressed, if container space gets scarce. |
String |
encode()
Returns a parseable string representation of this constant size. |
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. |
ConstantSize.Unit |
getUnit()
Returns this size's unit. |
double |
getValue()
Returns this size's value. |
int |
hashCode()
Returns a hash code value for the object. |
int |
maximumSize(Container container,
List components,
FormLayout.Measure minMeasure,
FormLayout.Measure prefMeasure,
FormLayout.Measure defaultMeasure)
Returns this size as pixel size. |
String |
toString()
Returns a string representation of this size object. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final ConstantSize.Unit PIXEL
public static final ConstantSize.Unit POINT
public static final ConstantSize.Unit DIALOG_UNITS_X
public static final ConstantSize.Unit DIALOG_UNITS_Y
public static final ConstantSize.Unit MILLIMETER
public static final ConstantSize.Unit CENTIMETER
public static final ConstantSize.Unit INCH
public static final ConstantSize.Unit PX
public static final ConstantSize.Unit PT
public static final ConstantSize.Unit DLUX
public static final ConstantSize.Unit DLUY
public static final ConstantSize.Unit MM
public static final ConstantSize.Unit CM
public static final ConstantSize.Unit IN
| Constructor Detail |
|---|
public ConstantSize(int value,
ConstantSize.Unit unit)
value - the size value interpreted in the given unitsunit - the size's unit
public ConstantSize(double value,
ConstantSize.Unit unit)
value - the size value interpreted in the given unitsunit - the size's unit| Method Detail |
|---|
public double getValue()
public ConstantSize.Unit getUnit()
public int getPixelSize(Component component)
component - the associated component
public int maximumSize(Container container,
List components,
FormLayout.Measure minMeasure,
FormLayout.Measure prefMeasure,
FormLayout.Measure defaultMeasure)
Invoked by FormSpec to determine
the size of a column or row.
maximumSize in interface Sizecontainer - 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
public boolean compressible()
#compressedSizes
to check whether a column or row can be compressed or not.ConstantSizes are incompressible.
compressible in interface Sizefalsepublic boolean equals(Object o)
equals in class Objecto - the Object with which to compare
true if this object is the same as the obj
argument; false otherwise.Object.hashCode(),
Hashtablepublic int hashCode()
java.util.Hashtable.
hashCode in class ObjectObject.equals(java.lang.Object),
Hashtablepublic String toString()
encode() instead.
toString in class Objectpublic String encode()
encode in interface Size
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||