I am using JDK8 build 87 and want to dynamically add and remove css stylesheets so that they can be used by my entire JavaFX application.
I am currently setting the default styleSheet with this command:
Application.setUserAgentStylesheet(Application.STYLESHEET_MODENA);
and then when I want to add an extra CSS stylesheet, I do this:
com.sun.javafx.css.StyleManager.getInstance.addUserAgentStylesheet(styleSheet);
It works, but I have two problems. Firstly, it uses a private API , and secondly, there seems to be no way to remove it as soon as I am done with it (I use OSGI , so it is common for modules to enter and exit).
In early 2012, there was talk of porting the StyleManager to the public API , but I'm not sure if something happened.
Does anyone know of a public method to add styleSheets so that they apply to the whole JavaFX application? Also how would I remove them?
(I do not have privileges to create a new javafx-8 tag)
java javafx-2 javafx-8
Boomah
source share