Package com.jgoodies.forms.layout
Class ConstantSize
- java.lang.Object
-
- com.jgoodies.forms.layout.ConstantSize
-
- All Implemented Interfaces:
Size,java.io.Serializable
public final class ConstantSize extends java.lang.Object implements Size, java.io.Serializable
An implementation of theSizeinterface that represents constant sizes described by a value and unit, for example: 10 pixel, 15 point or 4 dialog units. You can get instances ofConstantSizeusing the factory methods and constants in theSizesclass. Logical constant sizes that vary with the current layout style are delivered by theLayoutStyleclass.This class supports different size units:
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);
- Version:
- $Revision$
- Author:
- Karsten Lentzsch
- See Also:
Size,Sizes, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classConstantSize.UnitAn ordinal-based serializable typesafe enumeration for units as used in instances ofConstantSize.
-
Field Summary
Fields Modifier and Type Field Description static ConstantSize.UnitCENTIMETERstatic ConstantSize.UnitCMstatic ConstantSize.UnitDIALOG_UNITS_Xstatic ConstantSize.UnitDIALOG_UNITS_Ystatic ConstantSize.UnitDLUXstatic ConstantSize.UnitDLUYstatic ConstantSize.UnitINstatic ConstantSize.UnitINCHstatic ConstantSize.UnitMILLIMETERstatic ConstantSize.UnitMMstatic ConstantSize.UnitPIXELstatic ConstantSize.UnitPOINT
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)Indicates whether some other ConstantSize is "equal to" this one.intgetPixelSize(java.awt.Component component)Converts the size if necessary and returns the value in pixels.inthashCode()Returns a hash code value for the object.intmaximumSize(java.awt.Container container, java.util.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.java.lang.StringtoString()Returns a string representation of this size object.
-
-
-
Field Detail
-
PIXEL
public static final ConstantSize.Unit PIXEL
-
POINT
public static final ConstantSize.Unit POINT
-
DIALOG_UNITS_X
public static final ConstantSize.Unit DIALOG_UNITS_X
-
DLUX
public static final ConstantSize.Unit DLUX
-
DIALOG_UNITS_Y
public static final ConstantSize.Unit DIALOG_UNITS_Y
-
DLUY
public static final ConstantSize.Unit DLUY
-
MILLIMETER
public static final ConstantSize.Unit MILLIMETER
-
MM
public static final ConstantSize.Unit MM
-
CENTIMETER
public static final ConstantSize.Unit CENTIMETER
-
CM
public static final ConstantSize.Unit CM
-
INCH
public static final ConstantSize.Unit INCH
-
IN
public static final ConstantSize.Unit IN
-
-
Method Detail
-
getPixelSize
public int getPixelSize(java.awt.Component component)
Converts the size if necessary and returns the value in pixels.- Parameters:
component- the associated component- Returns:
- the size in pixels
-
maximumSize
public int maximumSize(java.awt.Container container, java.util.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
FormSpecto determine the size of a column or row.- Specified by:
maximumSizein interfaceSize- Parameters:
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- Returns:
- the computed maximum size in pixel
-
equals
public boolean equals(java.lang.Object o)
Indicates whether some other ConstantSize is "equal to" this one.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- the Object with which to compare- Returns:
trueif this object is the same as the obj argument;falseotherwise.- See Also:
Object.hashCode(),Hashtable
-
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 byjava.util.Hashtable.- Overrides:
hashCodein classjava.lang.Object- Returns:
- a hash code value for this object.
- See Also:
Object.equals(java.lang.Object),Hashtable
-
toString
public java.lang.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.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of the constant size
-
-