is there a way to change the size of a checkbox in JavaFx 8? The default size is pretty big and I found no way to change it, not with css nor by using the API of the checkbox control itself.
Asked
Active
Viewed 5,394 times
3 Answers
5
If you want to change the box's size of the CheckBox,you can use:
.check-box > .box {
-fx-padding: 10px;
}
and you also want to change the check mark,you can use:
.check-box > .box > .mark {
-fx-padding: 10px;
}
with the above css you can get a preview
All the javafx's built-in css selectors are in com/sun/javafx/scene/control/skin/caspian/caspian.css of jfxrt.jar

黄东辉
- 111
- 1
- 3
0
Hey you could use the padding to achieve that. Here is an example with radiobuttons.
Javafx 2.0 : How to change the size of the radio-buttons circle with CSS?
Should be the same in JavaFX 8 since its done with css
0
The CheckBox class provides several methods to set the size. .setPrefSize()
takes two doubles that set the preferred width and height.
CheckBox box = new CheckBox();
box.setPrefSize(prefWidth, prefHeight);

Dustin
- 693
- 8
- 20