CSSを用いたコントロールサイズの設定
背景色を設定するには「-fx-max-width」「-fx-max-height」を使用します。
-
-fx-max-width [ コントロール最大の幅を指定 ] -fx-max-height [ コントロール最大の高さを指定 ]
各種コントロールのsetStyleメソッドで「-fx-background-color:green;-fx-max-width:100;-fx-max-height:100;」を設定した実行結果を以下に示します。(実行結果をわかりやすくするために、背景をgreenに設定しています)
-
setStyle( "-fx-background-color:green;-fx-max-width:100;-fx-max-height:100;" )
実行例
Label
Labelの高さは「-fx-max-height」では出来ないようです。Labelの高さ「-fx-pref-height」を使用してください。
![](image/CSS_Label008.png)
Button
Buttonの高さは「-fx-max-height」では出来ないようです。Buttonの高さ「-fx-pref-height」を使用してください。
![](image/CSS_Button008.png)
TextField
TextFieldの高さは「-fx-max-height」では出来ないようです。TextFieldの高さ「-fx-pref-height」を使用してください。
![](image/CSS_TextField008.png)
TextArea
![](image/CSS_TextArea008.png)
CheckBox
CheckBoxの高さは「-fx-max-height」では出来ないようです。CheckBoxの高さ「-fx-pref-height」を使用してください。
![](image/CSS_CheckBox008.png)
RadioButton
RadioButtonの高さは「-fx-max-height」では出来ないようです。RadioButtonの高さ「-fx-pref-height」を使用してください。
![](image/CSS_RadioButton008.png)
ChoiceBox
ChoiceBoxの高さは「-fx-max-height」では出来ないようです。ChoiceBoxの高さ「-fx-pref-height」を使用してください。
![](image/CSS_ChoiceBox008.png)
ListView
![](image/CSS_ListView008.png)
ComboBox
ComboBoxの高さは「-fx-max-height」では出来ないようです。ComboBoxの高さ「-fx-pref-height」を使用してください。
![](image/CSS_ComboBox008.png)
Slider
Sliderの高さは「-fx-max-height」では出来ないようです。Sliderの高さ「-fx-pref-height」を使用してください。
![](image/CSS_Slider008.png)
Progress
Progressの高さは「-fx-max-height」では出来ないようです。Progressの高さ「-fx-pref-height」を使用してください。
![](image/CSS_ProgressBar008.png)
ToolBar
ToolBarの高さは「-fx-max-height」では出来ないようです。ToolBarの高さ「-fx-pref-height」を使用してください。
![](image/CSS_ToolBar008.png)
TreeView
![](image/CSS_TreeView008.png)
TreeTableView
![](image/CSS_TreeTableView008.png)
![](http://www12.a8.net/0.gif?a8mat=1TV743+7K35S2+249K+BWGDT)