CSSを用いたフォントの設定
CSSのフォント設定は次の4つのプロパティで設定します。4つのプロパティは、個別に設定することも、まとめて設定することも可能です。
-
-fx-font-family [ FontFamilyを指定 ] -fx-font-size [ Fontサイズを指定 ] -fx-font-style [ normal | italic | oblique ] -fx-font-weight [ normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 ]
まとめて設定する場合
-
-fx-font [ [ <font-style> || <font-weight> ] ? <font-size> <font-family> ]
各種コントロールのsetStyleメソッドで「-fx-font: italic 22 sans-serif 」を設定した実行結果を以下に示します。
-
setStyle( "-fx-font: italic 22 sans-serif" )
実行例
Label
![](image/CSS_Label003.png)
Button
![](image/CSS_Button003.png)
TextField
![](image/CSS_TextField003.png)
TextArea
![](image/CSS_TextArea003.png)
CheckBox
![](image/CSS_CheckBox003.png)
RadioButton
![](image/CSS_RadioButton003.png)
ChoiceBox
![](image/CSS_ChoiceBox003.png)
ListView
![](image/CSS_ListView003.png)
ComboBox
![](image/CSS_ComboBox003.png)
Slider
![](image/CSS_Slider003.png)
Progress
![](image/CSS_ProgressBar003.png)
ToolBar
![](image/CSS_ToolBar003.png)
TreeView
![](image/CSS_TreeView003.png)
TreeTableView
![](image/CSS_TreeTableView003.png)
![](http://www12.a8.net/0.gif?a8mat=1TV743+7K35S2+249K+BWGDT)