| java.lang.Object nextapp.echo2.app.Extent
Extent | public class Extent implements Comparable,Serializable(Code) | | A representation of a linear distance with units. Extent
objects are immutable once constructed.
WARNING: Many Component s will have
Extent -based properties that allow only certain types of
units. Make certain to verify the API specification of any
Component to ensure that you are using Extent s
correctly with it. The Extent -based getXXX()
and setXXX() property methods of a Component
will explain what types of Extent s are allowed.
|
Field Summary | |
final public static int | CM Centimeter units. | final public static int | EM Em units (height of font). | final public static int | EX Ex units (height of character 'x' in font). | final public static int | IN Inch units. | final public static int | MM Millimeter units. | final public static int | PC | final public static int | PERCENT Percentage units. | final public static int | PT Points (1pt = 1/72in). | final public static int | PX Pixel units. |
Constructor Summary | |
public | Extent(int value) Creates a new Extent with pixel units. | public | Extent(int value, int units) Creates a new Extent . |
Method Summary | |
public static Extent | add(Extent a, Extent b) Adds one Extent to another, returning the sum as a new
Extent . | public int | compareTo(Object o) | public boolean | equals(Object o) | public int | getUnits() Returns the units of the Extent . | public int | getValue() Returns the value of the Extent . | public boolean | isComparableTo(Extent that) Determines whether this Extent can be compared to another
Extent to determine which is a greater length. | public boolean | isEnglish() Determines if the Extent has English units, i.e., the
units are of type IN (inches), PC (picas), or
PT (points). | public boolean | isPercentage() Determines if the Extent has percentage-based units. | public boolean | isPrint() Determines if this Extent has 'print' based units, i.e.,
the units are in real dimensions, such as SI or English values, rather
than screen-based units such as pixels or percentages. | public boolean | isSI() Determines if the Extent has SI (Metric) units, i.e., the
units are of type MM (millimeters) or CM
(centimeters). | public int | toMm() Returns the value of the extent in millimeters. | public int | toPoint() Returns the value of the extent in points. | public String | toString() Returns a string describing the state of the Extent. | public static void | validate(Extent value, int validUnits) Validates that the specified Extent is acceptable for use
in a particular environment, by ensuring that its units are of a
supported type. |
CM | final public static int CM(Code) | | Centimeter units.
|
EM | final public static int EM(Code) | | Em units (height of font).
|
EX | final public static int EX(Code) | | Ex units (height of character 'x' in font).
|
IN | final public static int IN(Code) | | Inch units.
|
MM | final public static int MM(Code) | | Millimeter units.
|
PC | final public static int PC(Code) | | Picas (1pc = 12pt)
|
PERCENT | final public static int PERCENT(Code) | | Percentage units.
|
PT | final public static int PT(Code) | | Points (1pt = 1/72in).
|
PX | final public static int PX(Code) | | Pixel units.
|
Extent | public Extent(int value)(Code) | | Creates a new Extent with pixel units.
Parameters: value - the value of the extent in pixels |
Extent | public Extent(int value, int units)(Code) | | Creates a new Extent .
Parameters: value - the value of the extent Parameters: units - the units of the value, one of the following constants:PC : PixelsPERCENT : Percent (of size of containing component)PT : PointsCM : CentimetersMM : MillimetersIN : InchesEM : Ems (height of 'M' character)EX : Exs (height of 'x' character)PC : Picas
|
add | public static Extent add(Extent a, Extent b)(Code) | | Adds one Extent to another, returning the sum as a new
Extent . Null is returned if the Extent s have
incompatible units. If either provided Extent is null, the
other is returned.
Parameters: a - the first Extent Parameters: b - the second Extent the sum of the Extent s, if calculable |
getUnits | public int getUnits()(Code) | | Returns the units of the Extent .
The units of the Extent , one of the following constants:PC : PixelsPERCENT : Percent (of size of containing component)PT : PointsCM : CentimetersMM : MillimetersIN : InchesEM : Ems (height of 'M' character)EX : Exs (height of 'x' character)PC : Picas
|
getValue | public int getValue()(Code) | | Returns the value of the Extent .
The value of the Extent |
isComparableTo | public boolean isComparableTo(Extent that)(Code) | | Determines whether this Extent can be compared to another
Extent to determine which is a greater length.
Parameters: that - the Extent to test comparability to true if the Extent s can be compared |
isEnglish | public boolean isEnglish()(Code) | | Determines if the Extent has English units, i.e., the
units are of type IN (inches), PC (picas), or
PT (points).
true if this Extent has English units |
isPercentage | public boolean isPercentage()(Code) | | Determines if the Extent has percentage-based units.
true if the Extent has percentage-based units |
isPrint | public boolean isPrint()(Code) | | Determines if this Extent has 'print' based units, i.e.,
the units are in real dimensions, such as SI or English values, rather
than screen-based units such as pixels or percentages.
true if this Extent has 'print' based units |
isSI | public boolean isSI()(Code) | | Determines if the Extent has SI (Metric) units, i.e., the
units are of type MM (millimeters) or CM
(centimeters).
true if this Extent has SI units |
toMm | public int toMm()(Code) | | Returns the value of the extent in millimeters.
the value of the extent in millimeters throws: IllegalStateException - if the value cannot be returned in millimeters.Verify that isPrint() returns true to avoid potentially receiving this exception. |
toPoint | public int toPoint()(Code) | | Returns the value of the extent in points.
the value of the extent in points throws: IllegalStateException - if the value cannot be returned in points(verify that isPrint() returns true to avoid potentially receiving this exception). |
validate | public static void validate(Extent value, int validUnits)(Code) | | Validates that the specified Extent is acceptable for use
in a particular environment, by ensuring that its units are of a
supported type.
Parameters: value - the Extent to validate Parameters: validUnits - a bitmask containing one or more of the unit constants(multiple unit constants may be ORed together) throws: IllegalArgumentException - if the Extent is invalid |
|
|