Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Refresh or Reload CSS files that are already added to scene.getStyleSheets?

892635Oct 5 2011 — edited Oct 7 2011
Congratulations to the JavaFX 2.0 release! This looks really well! Especially that there is now a Mac Developer Preview version! :)

Is there a way to reload css style files that have already been applied to a scene?

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 styles at all.

Am I missing something or is this in general not supported?
This post has been answered by David Grieve-Oracle on Oct 5 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 4 2011
Added on Oct 5 2011
5 comments
2,088 views