I'm using JDK8 build 87 and would like to dynamically add and remove css stylesheets such that they can be used by my whole JavaFX application.
At the moment I'm setting the default styleSheet using this command:
Application.setUserAgentStylesheet(Application.STYLESHEET_MODENA);
and then when I want to add an additional css style sheet I do this:
com.sun.javafx.css.StyleManager.getInstance.addUserAgentStylesheet(styleSheet);
This works but I have two problems. Firstly, it is using a private API and secondly there doesn't seem to be a way to remove it once I have finished with it (I'm using OSGI so it is common for modules to come and go).
There was talk about moving StyleManager to public API at the start of 2012 but I'm not sure anything has happened about that.
Does anyone know of a public method to add styleSheets such that they apply to the whole JavaFX application? Also how would one remove them?
(I don't have the privileges to create the new javafx-8 tag)