- All Implemented Interfaces:
Serializable,Comparable<SizeUnits>,Constable
public enum SizeUnits extends Enum<SizeUnits>
Represents a size specified in a particular unit, such as 14px or 0.2em.
- Since:
- 9
-
Nested Class Summary
Nested classes/interfaces declared in class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants Enum Constant Description CMRepresents a size in centimeters.DEGRepresents an angle in degrees.EMRepresents a size in EM unit.EXRepresents a size in EX unit.GRADRepresents an angle in gradians.INRepresents a size in inches.MMRepresents a size in millimeters.MSRepresents time in milliseconds.PCRepresents a size in picas.PERCENTRepresents a size as a percentage.PTRepresents a size in points.PXRepresents a size in pixels.RADRepresents an angle in radians.SRepresents time in seconds.TURNRepresents an angle in turns. -
Method Summary
Modifier and Type Method Description booleanisAbsolute()Gets wehther thisSizeUnitsvalue is absolute.abstract doublepixels(double value, double multiplier, Font font)Calculates pixels for a particularSizeUnits.abstract doublepoints(double value, double multiplier, Font font)Calculates points for a particularSizeUnits.static SizeUnitsvalueOf(String name)Returns the enum constant of this type with the specified name.static SizeUnits[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
PERCENT
Represents a size as a percentage. -
IN
Represents a size in inches. -
CM
Represents a size in centimeters. -
MM
Represents a size in millimeters. -
EM
Represents a size in EM unit. Note: It is a unit relative to the font-size of the element. -
EX
Represents a size in EX unit. Note: In the absence of font metrics, oneEXis taken to be half anEMunit. -
PT
Represents a size in points. -
PC
Represents a size in picas. -
PX
Represents a size in pixels. -
DEG
Represents an angle in degrees. -
GRAD
Represents an angle in gradians. Note: 400 Gradians = 360 Degrees. -
RAD
Represents an angle in radians. -
TURN
Represents an angle in turns. Note: 1 Turn = 360 Degrees. -
S
Represents time in seconds. -
MS
Represents time in milliseconds.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
points
Calculates points for a particularSizeUnits.- Parameters:
value- valuemultiplier- multiplierfont- font- Returns:
- points for a particular
SizeUnits
-
pixels
Calculates pixels for a particularSizeUnits.- Parameters:
value- valuemultiplier- multiplierfont- font- Returns:
- pixels for a particular
SizeUnits
-
isAbsolute
public boolean isAbsolute()Gets wehther thisSizeUnitsvalue is absolute.- Returns:
- whether value is absoulute
-