本文整理匯總了Java中javafx.scene.text.FontWeight.findByName方法的典型用法代碼示例。如果您正苦於以下問題:Java FontWeight.findByName方法的具體用法?Java FontWeight.findByName怎麽用?Java FontWeight.findByName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.text.FontWeight
的用法示例。
在下文中一共展示了FontWeight.findByName方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import javafx.scene.text.FontWeight; //導入方法依賴的package包/類
private void init() {
val map = super.getMap();
map.put("family", new StringValue(font.getFamily()));
map.put("isItalic", NumberValue.fromBoolean(font.getStyle().toLowerCase().contains("italic")));
val weight = FontWeight.findByName(font.getStyle());
map.put("weight", NumberValue.of(weight != null
? (weight.getWeight())
: FontWeight.NORMAL.getWeight()));
map.put("size", NumberValue.of(font.getSize()));
}
示例2: extractWeight
import javafx.scene.text.FontWeight; //導入方法依賴的package包/類
private static FontWeight extractWeight(String style) {
for (String styleWord : style.split("\\s")) {
FontWeight weight = FontWeight.findByName(styleWord);
if (weight != null && weight != FontWeight.NORMAL) {
return weight;
}
}
return FontWeight.NORMAL;
}
示例3: testFont
import javafx.scene.text.FontWeight; //導入方法依賴的package包/類
@Theory
public void testFont(@FromDataPoints("extra") Gson gson) {
String family = "SansSerif";
FontWeight weight = FontWeight.findByName("Regular");
double size = 11.0;
Font font = Font.font(family, weight, size);
Function<WithFont, Font> getter = o -> o.font;
BiConsumer<WithFont, Font> setter = (o, f) -> o.font = f;
testValue(WithFont.class, null, "{\"font\":null}", getter, setter, gson);
testValue(WithFont.class, font, "{\"font\":\"SansSerif,Regular,11.0\"}", getter, setter, gson);
}
示例4: testFontProperty
import javafx.scene.text.FontWeight; //導入方法依賴的package包/類
@Theory
public void testFontProperty(@FromDataPoints("extra") Gson gson) {
String family = "SansSerif";
FontWeight weight = FontWeight.findByName("Regular");
double size = 11.0;
Font font = Font.font(family, weight, size);
testProperty(WithFontProp.class, null, "{\"prop\":null}", o -> o.prop, gson);
testProperty(WithFontProp.class, font, "{\"prop\":\"SansSerif,Regular,11.0\"}", o -> o.prop, gson);
}
示例5: FontStyle
import javafx.scene.text.FontWeight; //導入方法依賴的package包/類
public FontStyle(String styles) {
this();
String[] fontStyles = (styles == null ? "" : styles.trim().toUpperCase()).split(" "); //$NON-NLS-1$ //$NON-NLS-2$
for (String style : fontStyles) {
FontWeight w = FontWeight.findByName(style);
if (w != null) {
weight = w;
} else {
FontPosture p = FontPosture.findByName(style);
if (p != null)
posture = p;
}
}
}