- java.lang.Object
-
- java.lang.Enum<FontWeight>
-
- javafx.scene.text.FontWeight
-
- All Implemented Interfaces:
-
Serializable,Comparable<FontWeight>
public enum FontWeight extends Enum<FontWeight>
- 从以下版本开始:
- JavaFX 2.0
-
-
Enum Constant Summary
Enum Constants Enum Constant 描述 BLACK代表黑色字体重量(900)。BOLD代表粗体字体重(700)。EXTRA_BOLD代表“Extra Bold”字体重量(800)。EXTRA_LIGHT代表“Extra Light”字体重量(200)。LIGHT表示轻型字体重量(300)。MEDIUM表示中等字体重量(500)。NORMAL表示正常字体重量(400)。SEMI_BOLD代表“Demi Bold”字体重量(600)。THIN代表瘦体重(100)。
-
方法摘要
所有方法 静态方法 接口方法 具体的方法 Modifier and Type 方法 描述 static FontWeightfindByName(String name)以其名称返回FontWeight。static FontWeightfindByWeight(int weight)返回由CSS和OpenType规范定义的权重值最接近的FontWeight。intgetWeight()返回此FontWeight指定的视觉重量(黑度或厚度)。static FontWeightvalueOf(String name)以指定的名称返回此类型的枚举常量。static FontWeight[]values()按照它们声明的顺序返回一个包含此枚举类型常量的数组。
-
-
-
Enum Constant Detail
-
THIN
public static final FontWeight THIN
代表瘦体重(100)。
-
EXTRA_LIGHT
public static final FontWeight EXTRA_LIGHT
代表“Extra Light”字体重量(200)。
-
LIGHT
public static final FontWeight LIGHT
表示轻型字体重量(300)。
-
NORMAL
public static final FontWeight NORMAL
表示正常字体重量(400)。
-
MEDIUM
public static final FontWeight MEDIUM
表示中等字体重量(500)。
-
SEMI_BOLD
public static final FontWeight SEMI_BOLD
代表“Demi Bold”字体重量(600)。
-
BOLD
public static final FontWeight BOLD
代表粗体字体重(700)。
-
EXTRA_BOLD
public static final FontWeight EXTRA_BOLD
代表“Extra Bold”字体重量(800)。
-
BLACK
public static final FontWeight BLACK
代表黑色字体重量(900)。
-
-
方法详细信息
-
values
public static FontWeight[] values()
按照它们声明的顺序返回一个包含此枚举类型常量的数组。 该方法可用于遍历常量如下:for (FontWeight c : FontWeight.values()) System.out.println(c);- 结果
- 一个包含这个枚举类型的常量的数组,按照它们被声明的顺序
-
valueOf
public static FontWeight valueOf(String name)
以指定的名称返回此类型的枚举常量。 字符串必须完全匹配用于声明此类型的枚举常量的标识符。 (不允许使用外来空白字符。)- 参数
-
name- 要返回的枚举常量的名称。 - 结果
- 具有指定名称的枚举常数
- 异常
-
IllegalArgumentException- 如果此枚举类型没有指定名称的常量 -
NullPointerException- 如果参数为空
-
getWeight
public int getWeight()
返回此FontWeight指定的视觉重量(黑度或厚度)。- 结果
- 重量
-
findByName
public static FontWeight findByName(String name)
以其名称返回FontWeight。- 参数
-
name- 名称FontWeight - 结果
- FontWeight名称
-
findByWeight
public static FontWeight findByWeight(int weight)
返回由CSS和OpenType规范定义的权重值最接近的FontWeight。 如果两个FontWeight值之间的指定值是等距的,则实施可以自行选择。 此查找不引用字体,因此这完全是映射到FontWeight实例的集合,并不意味着该权重的字体将可用。- 参数
-
weight- 重量值 - 结果
-
最近
FontWeight
-
-