title: JavaFX WindowEvent.WINDOW_SHOWN firing before window actually shown
body: <p>The real reason I'm trying to do this is to run a game (infinite) loop when the UI shows, but this shows the same problem.</p>
  
  <pre><code>    primaryStage.setScene(new Scene(root));
  
      primaryStage.addEventHandler(WindowEvent.WINDOW_SHOWN, event -&gt; {
          System.out.println("Shown");
          try {
              Thread.sleep(4000);
          } catch (Exception e) {
              e.printStackTrace();
          }
      });
  
      primaryStage.show();
  </code></pre>
  
  <p>This code will result in a console message, then a 4 second wait, then the window actually shows.  I can't really find anything on this and it doesn't seem to make much sense since the documentation for WINDOW_SHOWN specifically states it fires just after the window is shown.</p>