Scene.getStylesheets() takes a list of URLs, so instead of using a resource file on the classpath I can use "file:///somepath". This works as expected. Now I'd like to change that file on the filesystem and then re-apply it to the scene to view my changes without the need to restart my application.
I tried to execute:
scene.getStylesheets().clear();
scene.getStylesheets().add("file:///somepath/stylesheet.css");
after I've changed the file /somepath/stylesheet.css on the filesystem but there is no change to the applied styles at all.
According to
https://forums.oracle.com/forums/thread.jspa?forumID=1385&threadID=2294345
this is possible using a private API:
com.sun.javafx.css.StyleManager.getInstance().reloadStylesheets(scene);
but adding official support for this (or a similar mechanism maybe even automatically) would probably be better.
I tried to execute:
scene.getStylesheets().clear();
scene.getStylesheets().add("file:///somepath/stylesheet.css");
after I've changed the file /somepath/stylesheet.css on the filesystem but there is no change to the applied styles at all.
According to
https://forums.oracle.com/forums/thread.jspa?forumID=1385&threadID=2294345
this is possible using a private API:
com.sun.javafx.css.StyleManager.getInstance().reloadStylesheets(scene);
but adding official support for this (or a similar mechanism maybe even automatically) would probably be better.
- relates to
-
JDK-8119450 Rule added to an already loaded CSS file have no effect when loaded in a new Scene
-
- Closed
-