Reloading stylesheets
Tom Schindl
tom.schindl at bestsolution.at
Tue Dec 10 07:15:07 PST 2013
No on FX8 you need to remove and readd them! So the only thing different
is that you omit the reload-call on FX8.
Tom
On 10.12.13 16:10, Werner Lehmann wrote:
> Got it. The key was to move the stylesheets from the root node to the
> scene before reloading them:
>
> scene.styleSheets.clear
> scene.styleSheets.addAll(root.styleSheets)
> root.styleSheets.clear
> styleManager.reload(scene)
>
> The hotkey also works now: shift+ctrl+7 reloads CSS while the scene is
> visible. This works by using a custom scene, overriding
> impl_processKeyEvent. Even better would be automatic change-detection
> (in debug mode only) but I don't have time to do this now. Previously
> you said that reloading is not needed on FX8... does this work out of
> the box then?
>
> Werner
>
> On 10.12.2013 14:10, Tom Schindl wrote:
>> 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
More information about the openjfx-dev
mailing list