|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnextapp.echo.Extent
public class Extent
A representation of a linear distance with units.
Extent
objects are immutable once constructed.
Field Summary | |
---|---|
static byte |
CM
Centimeter units. |
static byte |
EM
Em units (height of font). |
static byte |
EX
Ex units (height of character 'x' in font). |
static byte |
IN
Inch units. |
static byte |
MM
Millimeter units. |
static byte |
PC
Picas (1pc = 12pt) |
static byte |
PERCENT
Percentage units. |
static byte |
PT
Points (1pt = 1/72in). |
static byte |
PX
Pixel units. |
Constructor Summary | |
---|---|
Extent(int value,
int units)
Creates a new Extent . |
Method Summary | |
---|---|
static Extent |
add(Extent a,
Extent b)
Adds one Extent to another, returning the sum as a new
Extent . |
int |
compareTo(java.lang.Object o)
|
boolean |
equals(java.lang.Object o)
|
int |
getUnits()
Returns the units of the Extent . |
int |
getValue()
Returns the value of the Extent . |
boolean |
isComparableTo(Extent that)
Determines whether this Extent can be compared to another
Extent to determine which is a greater length. |
boolean |
isEnglish()
Determines if the Extent has English units, i.e., the
units are of type IN (inches), PC (picas), or
PT (points). |
boolean |
isPercentage()
Determines if the Extent has percentage-based units. |
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. |
boolean |
isSI()
Determines if the Extent has SI (Metric) units, i.e., the
units are of type MM (millimeters) or CM
(centimeters). |
int |
toMm()
Returns the value of the extent in millimeters. |
int |
toPoint()
Returns the value of the extent in points. |
java.lang.String |
toString()
Returns a string describing the state of the Extent. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final byte PX
public static final byte PERCENT
public static final byte PT
public static final byte CM
public static final byte MM
public static final byte IN
public static final byte EM
public static final byte EX
public static final byte PC
Constructor Detail |
---|
public Extent(int value, int units)
Extent
.
value
- the value of the extent.units
- the units of the value, one of the following constants:
PX
: PixelsPERCENT
: Percent (of size of containing
component)PT
: PointsCM
: CentimetersMM
: MillimetersIN
: InchesEM
: Ems (height of 'M' character)EX
: Exs (height of 'x' character)PC
: PicasMethod Detail |
---|
public static Extent add(Extent a, Extent b)
Extent
to another, returning the sum as a new
Extent
. Null is returned if the Extent
s have
incompatible units.
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
Comparable.compareTo(java.lang.Object)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public int getValue()
Extent
.
Extent
.public int getUnits()
Extent
.
Extent
, one of the following
constants:
PX
: PixelsPERCENT
: Percent (of size of containing
component)PT
: PointsCM
: CentimetersMM
: MillimetersIN
: InchesEM
: Ems (height of 'M' character)EX
: Exs (height of 'x' character)PC
: Picaspublic boolean isComparableTo(Extent that)
Extent
can be compared to another
Extent
to determine which is a greater length.
that
- The Extent
to test comparability to.
Extent
s can be compared.public boolean isEnglish()
Extent
has English units, i.e., the
units are of type IN
(inches), PC
(picas), or
PT
(points).
Extent
has English units.public boolean isSI()
Extent
has SI (Metric) units, i.e., the
units are of type MM
(millimeters) or CM
(centimeters).
Extent
has SI units.public boolean isPercentage()
Extent
has percentage-based units.
Extent
has percentage-based units.public boolean isPrint()
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.
Extent
has 'print' based units.public int toMm()
java.lang.IllegalStateException
- if the value cannot be returned in
millimeters.
Verify that isPrint()
returns true to avoid
potentially receiving this exception.public int toPoint()
java.lang.IllegalStateException
- if the value cannot be returned in points.
Verify that isPrint()
returns true to avoid
potentially receiving this exception.public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |