JavaFX CSS checkbox styling


Question

I have some JavaFX checkboxes and want to style labels that I've assigned to them. I've put this in my .css file, but it doesn't change anything:

.check-box .label {
    -fx-font-size: 18;
    -fx-font-weight: bold;
}

What am I doing wrong?

1
1
4/10/2014 12:29:22 PM

Accepted Answer

Assuming that when you say you've "assigned labels to the check boxes" you mean that you've set text on them (either CheckBox cbox = new CheckBox("Check this"); or cbox.setText("Check this");, then you just need to omit the .label from the css:

.check-box {
    -fx-font-size: 18;
    -fx-font-weight: bold;
}
6
4/10/2014 1:30:25 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon