Bade
Bade

Reputation: 709

JavaFX CSS checkbox styling

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?

Upvotes: 2

Views: 7938

Answers (1)

James_D
James_D

Reputation: 209319

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;
}

Upvotes: 7

Related Questions