Advertisement
Guest User

UI fxml

a guest
May 25th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.13 KB | None | 0 0
  1.     /**
  2.      *  Metodo que crea la ventana principal y asigna el nombre
  3.     **/
  4.    
  5.     @Override
  6.     public void start(Stage primaryStage) throws IOException {
  7.        
  8.         this.primaryStage = primaryStage;
  9.         this.primaryStage.setTitle("WeebReader App");
  10.         showMainView();
  11.         vista = "Login";
  12.         showMainVistas(vista);
  13.     }
  14.    
  15.  
  16.     /**
  17.      * Metodo que carga la Scena principal a la ventana y la muestra activa
  18.     **/
  19.     private  void showMainView() throws IOException {
  20.        
  21.         FXMLLoader loader = new FXMLLoader();
  22.         loader.setLocation(UI.class.getResource("/org/weebreader/UI/Vistas/VistaPrincipal.fxml"));
  23.         mainLayout  = loader.load();
  24.         Scene scene = new Scene (mainLayout);
  25.         primaryStage.setScene(scene);
  26.         primaryStage.show();
  27.     }
  28.    
  29.  
  30.    
  31.     /**
  32.      * Metodo generico para cargar .FXML
  33.      * @param recibe un String el cual es el nombre del archivo .fxml
  34.     **/
  35.    
  36.     public static void showMainVistas(String extencion) throws IOException {
  37.        
  38.         FXMLLoader loader = new FXMLLoader();
  39.         loader.setLocation(UI.class.getResource("/org/weebreader/UI/Vistas/"+ extencion +".fxml"));
  40.         AnchorPane mainItems = loader.load();
  41.         mainLayout.setCenter(mainItems);
  42.        
  43.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement