title: Opening a new scene in java FX
body: <p>I have two FXML files and one Controller.  </p>
  
  <p>I have posted the code in which i have tried to  create a second stage (and failed). </p>
  
  <p>Error message is:  </p>
  
  <pre><code>javafx.scene.layout.AnchorPane cannot be cast to javafx.fxml.FXMLLoader 
  </code></pre>
  
  <p>How do I fix it?</p>
  
  <pre><code>@FXML private Scene trial_scene;
  @FXML public  Stage m;     
  
  @FXML public void click(Stage stage) throws IOException {
      m = new Stage();
      openWindow(); 
  }
  
  @FXML private void openWindow() throws IOException {
      FXMLLoader root =FXMLLoader.load(
          SampleController.class.getResource(
              "settings.fxml"
          )
      );
      m.initModality(Modality.WINDOW_MODAL);
      m.setTitle("My modal window");
      m.setScene(trial_scene);
      m.show();
  }
  </code></pre>