The word cascading in the Cascading Style Sheets (CSS) refers to the priority scheme or order to apply different styles to the one Node.
If styles are applied to the Node by different means, JavaFX will apply them according to the following rules of priority:
- A style from Application.setUserAgentStylesheet()
- A value set by an API call such as btn.setMinHeight(50);
- A style from a CSS file set through Scene.getStylesheets() or Parent.getStylesheets()
- A style from Node.setStyle() overrides all the above items
Thus, setStyle() overrides any other style settings. And it really does: once you have changed a property with setStyle(), you can't change it by any other means. ...