title: Getting size of FXML generated nodes
body: <p>I want to get the size of a node, after it has been sized properly, which I understand is done after the stage is shown. however, i cannot do it in start() method, because the node is not initialized yet, because its loaded it from an FXML file.</p>
  
  <p>If I implement Initializable Interface and try to get the size in initialize() method, it returns 0.0</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import java.lang.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  &lt;?import javafx.scene.layout.BorderPane?&gt;
  
  &lt;GridPane xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8" fx:controller="musicPlayer.Test"&gt;
  &lt;columnConstraints&gt;
  &lt;ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /&gt;
  &lt;/columnConstraints&gt;
  &lt;rowConstraints&gt;
  &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
  &lt;/rowConstraints&gt;
  &lt;children&gt;
    &lt;TableView fx:id="testNode"&gt;
      &lt;columns&gt;
        &lt;TableColumn prefWidth="75.0" text="C1" /&gt;
        &lt;TableColumn prefWidth="75.0" text="C2" /&gt;
      &lt;/columns&gt;
    &lt;/TableView&gt;
  &lt;/children&gt;
  &lt;/GridPane&gt;
  </code></pre>
  
  <p>just an arbitrary node in a grid pane generated with scene builder</p>
  
  <pre><code>public class Test extends Application implements Initializable {
  @FXML
  private TableView testNode;
  
  public void initialize(URL location, ResourceBundle resources) {
      //System.out.println(testNode.getWidth()); is always 0.0 
  }
  
  public void start(Stage primaryStage) throws Exception {
      Parent root = FXMLLoader.load(getClass().getResource("test.fxml"));
      Scene scene = new Scene(root);
      primaryStage.setScene(scene);
      primaryStage.show();
      //System.out.println(testNode.getWidth()); throws Nullpointer Exception
  }
  
  public static void main(String[] args) {
      launch(args);
  }
  }
  </code></pre>
  
  <p>I've also tried adding a listener to the stage, but i still get a nullpointer exception.
  Is there a way of getting the size, without using a sleeping thread?</p>