title: Loading FXML from external controller on Java FX 2.2
body: <p>I'm currently recoding a small application from Swing to JavaFX, since it seemed like the easiest way to deploy what I currently have for web. </p>
  
  <p>I can't seem to do something very simple, and I'm getting lost on the documentation and other posts: </p>
  
  <p>Anyway, I have my main controller that calls the associated FXML file: </p>
  
  <pre><code>public void start(Stage stage) throws Exception {
      Parent root = FXMLLoader.load(getClass().getResource("Login.fxml"));
  
      Scene scene = new Scene(root);
  
      stage.setScene(scene);
      stage.show();
  }
  </code></pre>
  
  <p>Now, from Login.fxml, I have a button and I want that button to open another FXML file. I can get the button to be sucesfully load the event but I tried many things and I can't get it to work. I'm trying something like this: </p>
  
  <pre><code>private void handleButtonAction(ActionEvent event){
  
      FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("GeneradorBases.fxml"));
  
     // fxmlLoader.setRoot(this); 
    //  fxmlLoader.setController(this);
  
      try {
          fxmlLoader.load(); 
  
      }
      catch (IOException e){
         throw new RuntimeException(e); 
      }
  }
  </code></pre>
  
  <p>I tried to follow an example I saw here on Stackoverflow. Basically the .setRoot and .setController crash the application. Even the .load() does that too. </p>
  
  <p>Any advice on how I can make this work?</p>