Reloading stylesheets

Tom Schindl tom.schindl at bestsolution.at
Tue Dec 10 05:10:37 PST 2013


My code does:

> // Force CSS-Reloading
> if( isJavaFX2() ) {
>   ReflectiveInvoke.onStyleManagerClass(scene);
> }
> 
> scene.getStylesheets().clear();	
> scene.getStylesheets().addAll(contentData.cssFiles);

A difference I see is that your stylesheets are on the Root-Container
whereas mine are directly on the Scene.

Tom

On 10.12.13 14:02, Werner Lehmann wrote:
> Thanks, Tom. Somehow it does not work for me. Any idea?
> 
> Basically this is what I am doing:
> 
> Parent root = ...
> root.getStyleSheets().add(...stylesheets...)
> Scene scene = new Scene(root)
> StyleManager.getInstance().reloadStylesheets(scene)
> 
> Then I show the scene in a JFXPanel, change and save the stylesheet in
> Eclipse, and reopen the window which repeats all of the above. But the
> css changes are not reflected until I restart the application.
> 
> On 10.12.2013 13:30, Tom Schindl wrote:
>> com.sun.javafx.css.StyleManager.getInstance().reloadStylesheets(scene);



More information about the openjfx-dev mailing list