當前位置: 首頁>>代碼示例>>Java>>正文


Java FontWeight.findByName方法代碼示例

本文整理匯總了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()));
}
 
開發者ID:aNNiMON,項目名稱:HotaruFX,代碼行數:11,代碼來源:FontValue.java

示例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;
}
 
開發者ID:joffrey-bion,項目名稱:fx-gson,代碼行數:10,代碼來源:FontTypeAdapter.java

示例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);
}
 
開發者ID:joffrey-bion,項目名稱:fx-gson,代碼行數:14,代碼來源:FxGsonTest.java

示例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);
}
 
開發者ID:joffrey-bion,項目名稱:fx-gson,代碼行數:11,代碼來源:FxGsonTest.java

示例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;
		}
	}
}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:15,代碼來源:FontViewComposite.java


注:本文中的javafx.scene.text.FontWeight.findByName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。