Enum Class SizeUnits
- 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 Constant | Description |
|---|---|
CM |
Represents a size in centimeters. |
DEG |
Represents an angle in degrees. |
EM |
Represents a size in EM unit. |
EX |
Represents a size in EX unit. |
GRAD |
Represents an angle in gradians. |
IN |
Represents a size in inches. |
MM |
Represents a size in millimeters. |
MS |
Represents time in milliseconds. |
PC |
Represents a size in picas. |
PERCENT |
Represents a size as a percentage. |
PT |
Represents a size in points. |
PX |
Represents a size in pixels. |
RAD |
Represents an angle in radians. |
S |
Represents time in seconds. |
TURN |
Represents an angle in turns. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
isAbsolute() |
Gets wehther this SizeUnits value is absolute. |
abstract double |
pixels |
Calculates pixels for a particular SizeUnits. |
abstract double |
points |
Calculates points for a particular SizeUnits. |
static SizeUnits |
valueOf |
Returns the enum constant of this class with the specified name. |
static SizeUnits[] |
values() |
Returns an array containing the constants of this enum class, in the order they are declared. |
Enum Constant Details
PERCENT
public static final SizeUnits PERCENT
Represents a size as a percentage.
IN
public static final SizeUnits IN
Represents a size in inches.
CM
public static final SizeUnits CM
Represents a size in centimeters.
MM
public static final SizeUnits MM
Represents a size in millimeters.
EM
public static final SizeUnits EM
Represents a size in EM unit. Note: It is a unit relative to the font-size of the element.
EX
public static final SizeUnits EX
Represents a size in EX unit. Note: In the absence of font metrics, one
EX is taken to be half an EM unit.PT
public static final SizeUnits PT
Represents a size in points.
PC
public static final SizeUnits PC
Represents a size in picas.
PX
public static final SizeUnits PX
Represents a size in pixels.
DEG
public static final SizeUnits DEG
Represents an angle in degrees.
GRAD
public static final SizeUnits GRAD
Represents an angle in gradians. Note: 400 Gradians = 360 Degrees.
RAD
public static final SizeUnits RAD
Represents an angle in radians.
TURN
public static final SizeUnits TURN
Represents an angle in turns. Note: 1 Turn = 360 Degrees.
S
public static final SizeUnits S
Represents time in seconds.
MS
public static final SizeUnits MS
Represents time in milliseconds.
Method Details
values
public static SizeUnits[] values()
Returns an array containing the constants of this enum class, in the order they are declared.
- Returns:
- an array containing the constants of this enum class, in the order they are declared
valueOf
public static SizeUnits valueOf(String name)
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name -
NullPointerException- if the argument is null
points
public abstract double points(double value, double multiplier, Font font)
Calculates points for a particular
SizeUnits.- Parameters:
-
value- value -
multiplier- multiplier -
font- font - Returns:
- points for a particular
SizeUnits
pixels
public abstract double pixels(double value, double multiplier, Font font)
Calculates pixels for a particular
SizeUnits.- Parameters:
-
value- value -
multiplier- multiplier -
font- font - Returns:
- pixels for a particular
SizeUnits
isAbsolute
public boolean isAbsolute()
Gets wehther this
SizeUnits value is absolute.- Returns:
- whether value is absoulute
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.