title: Login Application with 1 stage and multiple scene in JavaFX
body: <p>I am doing a timeline project. I have successfully created a login system and menus for everything, but when I press the buttons I have done so it will open a new window(with stage, scenes). I have read that it isn't the best approach. The best way would be to only have 1 primary stage, and that one would be when I launch the application, the login. </p>
  
  <p>But I have looked for information about multiple scenes with one stage but I have not found any good solutions. Would really really appreciate some help ;) Hopefully you understand what I want to achieve. Worth mentioning, i=I'm dealing with Scenebuilder and fxml files so I all I want to basically do is load a new .fxml scene onto the primary stage. </p>
  
  <p>So I have looked in another thread and try to do a VistaFramework that handles all of the scene changes. 
  But I don't understand it fully, and I cant get it to work. </p>
  
  <pre><code>package application;
  
  import javafx.fxml.FXMLLoader;
  
  import java.io.IOException;
  
  import controllers.MainController;
  
  /**
   * Utility class for controlling navigation between vistas.
   *
   * All methods on the navigator are static to facilitate
   * simple access from anywhere in the application.
   */
  public class VistaNavigator {
  
      /**
       * Convenience constants for fxml layouts managed by the navigator.
       */
      public static final String MAIN    = "LoginGUI.fxml";
      public static final String NEW_USER = "NewUserGUI.fxml";
      public static final String STARTMENU = "StartMenuGUI.fxml";
  
      /** The main application layout controller. */
      private static MainController mainController;
  
      /**
       * Stores the main controller for later use in navigation tasks.
       *
       * @param mainController the main application layout controller.
       */
      public static void setMainController(MainController mainController) {
          VistaNavigator.mainController = mainController;
      }
  
      /**
       * Loads the vista specified by the fxml file into the
       * vistaHolder pane of the main application layout.
       *
       * Previously loaded vista for the same fxml file are not cached.
       * The fxml is loaded anew and a new vista node hierarchy generated
       * every time this method is invoked.
       * @param fxml the fxml file to be loaded.
       */
  
      public static void loadVista(String fxml) {
          try {
              mainController.setVista(
                  FXMLLoader.load(
                      VistaNavigator.class.getResource(
                          fxml
                      )
                  )
              );
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  
  }
  </code></pre>
  
  <p>I get a error in loadVista(). Get the following error at mainController.setVista( "The method setVista(Node) in the type MainController is not applicable for the arguments (Object)" </p>