How to see when a scene gets shown?

Werner Lehmann lehmann at media-interactive.de
Thu Jun 13 07:26:22 PDT 2013


Yes, that's what I meant before:

>     sceneProperty().addListener(new InvalidationListener() {
>       @Override
>       public void invalidated(Observable arg0)
>       {
>         Scene s = getScene();
>         if (s != null)
>         {
>           s.windowProperty().addListener(new InvalidationListener() {
>             @Override
>             public void invalidated(Observable arg0)
>             {
>               if (getScene() != null && getScene().getWindow() != null)
>               {
...
>               }
>             }
>           });
>         }
>       }
>     });

By the way, this is part of a workaround to hide a popup when the window 
underneath (a JFrame) is moved. AutoHide won't work with JFXPanel involved.

Werner

On 13.06.2013 15:11, David Grieve wrote:
> Get the window of the scene and add a handler for the onShownProperty
> via the setOnShown method. Add a listener to the Scene's
> windowProperty and add/remove your handler there.


More information about the openjfx-dev mailing list