title: FXMLLoader getController returns NULL?
body: <p>I have the main application class that does the following just fine:</p>
  
  <pre><code>   @Override
     public void start(Stage primaryStage) {
        try {
           FXMLLoader loader = new FXMLLoader(getClass().getResource(
                 "RecordScreen.fxml"));
           Parent root = (Parent) loader.load();
           Scene newScene = new Scene(root);
           Stage newStage = new Stage();
           newStage.setScene(newScene);
           newStage.show();
        } catch (Exception e) {
           e.printStackTrace();
        }
     }
  </code></pre>
  
  <p>It launches a table view that displays people. I select a person, hit the edit button, and try to launch a window that will let me edit them.</p>
  
  <pre><code>   @FXML
     public void editPerson() {
        try {
           FXMLLoader loader = new FXMLLoader(getClass().getResource(
                 "PersonEditor.fxml"));
           PersonEditorCtrl ctrl = loader.getController();
           ctrl.init(table.getSelectionModel().getSelectedItem());
           Parent root = (Parent) loader.load();
           Scene newScene = new Scene(root);
           Stage newStage = new Stage();
           newStage.setScene(newScene);
           newStage.show();
        } catch (Exception e) {
           e.printStackTrace();
        }
     }
  </code></pre>
  
  <p>The problem is, getController is returning null. I have been following this pattern for the past 2 weeks with no problems whatsoever. What am I doing wrong now? These untraceable bugs are aggravating!!!</p>
  
  <p>Here are my two fxmls:</p>
  
  <p>The screen with tableview:</p>
  
  <pre><code>&lt;AnchorPane xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="application.RecordsCtrl"&gt;
    &lt;!-- TODO Add Nodes --&gt;
    &lt;children&gt;
      &lt;VBox id="VBox" alignment="CENTER" spacing="0.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"&gt;
        &lt;children&gt;
          &lt;TableView fx:id="table" prefHeight="-1.0" prefWidth="-1.0"&gt;
            &lt;columns&gt;
              &lt;TableColumn prefWidth="75.0" text="Name" fx:id="nameCol" /&gt;
              &lt;TableColumn prefWidth="75.0" text="Age" fx:id="ageCol" /&gt;
            &lt;/columns&gt;
          &lt;/TableView&gt;
          &lt;Button mnemonicParsing="false" onAction="#editPerson" text="Edit" /&gt;
        &lt;/children&gt;
      &lt;/VBox&gt;
    &lt;/children&gt;
  &lt;/AnchorPane&gt;
  </code></pre>
  
  <p>The person editor:</p>
  
  <pre><code>&lt;AnchorPane xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="application.PersonEditorCtrl"&gt;
    &lt;!-- TODO Add Nodes --&gt;
    &lt;children&gt;
      &lt;VBox layoutX="0.0" layoutY="0.0" prefHeight="-1.0" prefWidth="-1.0"&gt;
        &lt;children&gt;
          &lt;TextField fx:id="nameField" prefWidth="200.0" /&gt;
          &lt;TextField fx:id="ageField" prefWidth="200.0" /&gt;
          &lt;Button mnemonicParsing="false" text="Button" /&gt;
        &lt;/children&gt;
      &lt;/VBox&gt;
    &lt;/children&gt;
  &lt;/AnchorPane&gt;
  </code></pre>