俺だけの秘密基地 IT系技術局
Java関連技術情報セクション

CSSを用いたコントロールサイズの設定

背景色を設定するには「-fx-max-width」「-fx-max-height」を使用します。


各種コントロールのsetStyleメソッドで「-fx-background-color:green;-fx-max-width:100;-fx-max-height:100;」を設定した実行結果を以下に示します。(実行結果をわかりやすくするために、背景をgreenに設定しています)

実行例

Label

Labelの高さは「-fx-max-height」では出来ないようです。Labelの高さ「-fx-pref-height」を使用してください。

【 Label 実行結果 】

Button

Buttonの高さは「-fx-max-height」では出来ないようです。Buttonの高さ「-fx-pref-height」を使用してください。

【 Button 実行結果 】

TextField

TextFieldの高さは「-fx-max-height」では出来ないようです。TextFieldの高さ「-fx-pref-height」を使用してください。

【 TextField 実行結果 】

TextArea

【 TextArea 実行結果 】

CheckBox

CheckBoxの高さは「-fx-max-height」では出来ないようです。CheckBoxの高さ「-fx-pref-height」を使用してください。

【 CheckBox 実行結果 】

RadioButton

RadioButtonの高さは「-fx-max-height」では出来ないようです。RadioButtonの高さ「-fx-pref-height」を使用してください。

【 RadioButton 実行結果 】

ChoiceBox

ChoiceBoxの高さは「-fx-max-height」では出来ないようです。ChoiceBoxの高さ「-fx-pref-height」を使用してください。

【 ChoiceBox 実行結果 】

ListView

【 ListView 実行結果 】

ComboBox

ComboBoxの高さは「-fx-max-height」では出来ないようです。ComboBoxの高さ「-fx-pref-height」を使用してください。

【 ComboBox 実行結果 】

Slider

Sliderの高さは「-fx-max-height」では出来ないようです。Sliderの高さ「-fx-pref-height」を使用してください。

【 Slider 実行結果 】

Progress

Progressの高さは「-fx-max-height」では出来ないようです。Progressの高さ「-fx-pref-height」を使用してください。

【 Progress 実行結果 】

ToolBar

ToolBarの高さは「-fx-max-height」では出来ないようです。ToolBarの高さ「-fx-pref-height」を使用してください。

【 ToolBar 実行結果 】

TreeView

【 TreeView 実行結果 】

TreeTableView

【 TreeTableView 実行結果 】



Back JavaFX Menu