title: No Javafx-2 event when a scene is shown
body: <p>I can't seem to find a way to register an event listener of a scene or node class that would get dispatched when that scene is shown.</p>
  
  <p>I want my Scene classes to be self-contained so I can use a builder class to construct them and have any of their animations fire when they are shown. For example, I'd like to be able to do something like the following in my Application class...</p>
  
  <pre><code>public void start(Stage primaryStage) {
      primaryStage.setScene(AnimatedLoginSceneBuilder.create()
          .width(1024)
          .height(768)
          .frameRate(25)
          .build();
      )
      primaryStage.show();
  }
  </code></pre>
  
  <p>My AnimatedLoginSceneBuilder class creates a scene and an animation which it binds to some nodes within the scene. I can only return the scene with the build method however (not the animation class). For example it looks something like this...</p>
  
  <pre><code>public class AnimatedLoginSceneBuilder implements Builder&lt;Scene&gt; {
      // private members such as width, height and framerate
      // methods to set width, height and framerate (e.g. width(double width))
  
      public Scene build() {
          DoubleProperty x = new SimpleDoubleProperty();
          Text node = TextNodeBuilder...
          node.xProperty().bind(x);
          final Timeline animation = TimelineBuilder... // animate x
          return SceneBuilder.create()
             . // create my scene using builders (bar the node above)
             .build();
      }
  }
  </code></pre>
  
  <p>But I have no way to play the animation and so I'd like to have some hook like...</p>
  
  <pre><code>public class AnimatedLoginSceneBuilder ... {
      ...
      public Scene build() {
          ... 
          final Timeline animation = TimelineBuilder... // animate x
          return SceneBuilder.create()
              . // create scene declaratively
              .onShow(new EventHandler&lt;SomeEvent&gt;() {
                  @Overide public void handleSomeEvent() {
                      animation.play();
                  }
              .build()
      }
  </code></pre>
  
  <p>Then when the scene is shown, it will play automatically. Too much to ask?</p>
  
  <p>One alternative would be to have the builder class return both the scene and the animation wrapped in an object and do something like...</p>
  
  <pre><code>public void start(Stage primaryStage) {
      WrapperObj loginSceneWrapper = AnimatedLoginSceneBuilder.create()
         .width(1024)
         .height(768)
         .frameRate(25)
         .build();
  
      primaryStage.setScene(wrapperObj.getScene());
      primaryStage.show();
      wrapperObj.getAnimation().play();
  </code></pre>
  
  <p>But this isn't what I want because I want to be able to change to a new scene from within an existing one and make no assumptions. For example I'd like to be able to have an event-handler in the scene be able to get the stage to transition to a new scene and as such, I'd just like to be able to call primaryStage.setScene(new scene I want to go to).</p>
  
  <p>Any ideas?</p>
  
  <p>The closest I've seen is <a href="https://stackoverflow.com/questions/8944445/how-to-listen-for-windowevent-window-shown-in-the-nodes-of-the-scene-graph">How to listen for WindowEvent.WINDOW_SHOWN in the nodes of the scene graph?</a> but that won't work for this case.</p>