title: JavaFX Button onAction won't open selected FXML view
body: <p>I'm stuck with the 'menu screen' for a while.</p>
  
  <p>when I click ACTIVATED CUSTOMER PANEL, it wont open the CustomerDisplay.fxml</p>
  
  <p><a href="https://i.stack.imgur.com/u4dhr.png" rel="nofollow noreferrer">Main Screen</a></p>
  
  <p>Below is my codes;</p>
  
  <pre><code>public class MainApp extends Application {
  
  protected Parent content;
  private Stage primaryStage;
  private Stage secondStage;
  private CustomerController custCtrl;
  private MaintainerController mntnCtrl;
  private MachineryController machCtrl;
  private String fxml="";
  public static MainApp instance;
  
  public MainApp () {
      instance=this;
  }
  
  /**
   * @param args
   */
  public static void main(String[] args) {    
      launch(args);
  }
  
  public static MainApp getInstance() {
      return instance;
  }
  
  @Override
  public void start(Stage primaryStage) throws Exception {
      initializePanel();
      Scene scene = new Scene(content);
  
      primaryStage.setResizable(false);
      primaryStage.initStyle(StageStyle.UTILITY);
  
      primaryStage.setScene(scene);
      primaryStage.show();
  }
  
  private void initializePanel() throws IOException{
      FXMLLoader loader = new FXMLLoader();
      loader.setLocation(getClass().getResource("fxml/SimulatorDisplay.fxml"));
      content = loader.load();        
  }
  
  public void openCustomerPanel() throws IOException{
      FXMLLoader loader = new FXMLLoader();
      loader.setLocation(getClass().getResource("fxml/CustomerDisplay.fxml"));
      content = loader.load(); 
  }
  
  public void openMaintainerPanel() throws IOException{
      FXMLLoader loader = new FXMLLoader();
      loader.setLocation(getClass().getResource("fxml/MaintainerDisplay.fxml"));
      content = loader.load();        
  }
  
  public void openMachineryPanel() throws IOException{
      FXMLLoader loader = new FXMLLoader();
      loader.setLocation(getClass().getResource("fxml/MachineryDisplay.fxml"));
      content = loader.load();        
  }   
  </code></pre>
  
  <p>}</p>
  
  <pre><code>public class SimulatorController implements Initializable{{
  .
  .
  .
      @FXML
      public void clickCustomer (ActionEvent event) throws IOException{
          log.info("Starting Customer Panel");
          MainApp.getInstance().openCustomerPanel()**;
      }
  }
  </code></pre>
  
  <p>It prints log.info("Starting Customer Panel") but I couldn't see any new window.
  I want to know how we can click a button on main screen, and display new window. The main screen remain open unless we close it. Do we need to define new Stage? </p>