title: JavaFX-2: how to get window size if it wasn't set manually?
body: <p>I want to open a dialog window above the center of its parent window, so I use the following formula:</p>
  
  <pre><code>Window window = ((Node) actionEvent.getSource()).getScene().getWindow();
  Scene scene = new Scene(new Group(new DialogWindow()));
  Stage dialog = new Stage();
  dialog.initOwner(window);
  dialog.sizeToScene();
  
  dialog.setX(stage.getX() + stage.getWidth() / 2 - dialog.getWidth() / 2); //dialog.getWidth() = NaN
  dialog.setY(stage.getY() + stage.getHeight() / 2 - dialog.getHeight() / 2); //dialog.getHeight() = NaN
  
  dialog.setScene(scene);
  dialog.show(); //it is better to showAndWait();
  </code></pre>
  
  <p>I don't set size the manually because I need the window to be sized automatically to the size of its content.</p>
  
  <p>Under Linux it sets window straight in the center of the parent window. But in Windows it doesn't work and leads to different results.</p>
  
  <p>How can I get the dialog's width and height if I don't set them manually?</p>