corpico corpico - 1 year ago 102
CSS Question

Make Default Buttons Look Like Normal Buttons

I have a JavaFX button that has been set as Default Button so the user can select it with the Enter key. Currently, it has a blue background:

enter image description here

But I'd like to make it look like a normal button:

enter image description here

I took a look at the JavaFX CSS Guide and it looks like there's only one feature to override (


enter image description here

But changing this feature has unpredictable effects—sometimes it eliminates the button's gradient; sometimes it makes the button transparent.

Is there a simple way to just get rid of the Default Button styling?

Answer Source

My guess is that you are looking in the wrong style sheet. The old default style sheet caspian.css was replaced with modena.css. So setting default value for -fx-base from modena.css should fix the issue:

.button:default {
    -fx-base: #ececec;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download