public enum Unit extends Enum<Unit>
Enum Constant and Description |
---|
CH
Unit code representing the width of the "0" (zero).
|
CM
Unit code representing centimeters.
|
EM
Unit code representing the font-size of the relevant font.
|
EX
Unit code representing the x-height of the relevant font.
|
INCH
Unit code representing inches.
|
MM
Unit code representing millimeters.
|
PERCENTAGE
Unit code representing in percentage of the containing element defined by
terminal.
|
PICAS
Unit code representing picas (12 points).
|
PIXELS
Unit code representing pixels.
|
POINTS
Unit code representing points (1/72nd of an inch).
|
REM
Unit code representing the font-size of the root font.
|
VH
Unit code representing the viewport's height.
|
VMAX
Unit code representing the viewport's larger dimension.
|
VMIN
Unit code representing the viewport's smaller dimension.
|
VW
Unit code representing the viewport's width.
|
Modifier and Type | Method and Description |
---|---|
static float |
getSize(String cssSize)
Gives size component as float of the css string representing a size.
|
String |
getSymbol() |
static Optional<Unit> |
getUnit(String cssSize)
Gives size unit of the css string representing a size.
|
static Unit |
getUnitFromSymbol(String symbol)
Convert unit string symbol to Unit.
|
String |
toString() |
static Unit |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Unit[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Unit PERCENTAGE
public static final Unit PIXELS
public static final Unit REM
public static final Unit EM
public static final Unit VW
public static final Unit VH
public static final Unit VMIN
public static final Unit VMAX
public static final Unit POINTS
public static final Unit PICAS
public static final Unit EX
public static final Unit MM
public static final Unit CH
public static final Unit CM
public static final Unit INCH
public static Unit[] values()
for (Unit c : Unit.values()) System.out.println(c);
public static Unit valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic String getSymbol()
public static Optional<Unit> getUnit(String cssSize)
cssSize
- Css compliant size string such as "50px".public static float getSize(String cssSize)
cssSize
- Css compliant size string such as "50px".Copyright © 2025. All rights reserved.