/** * This method is called when the splash screen has finished initializing the application. The * initialized resources are in a ServiceLocator singleton. Our task is to now create the * application MVC components, to hide the splash screen, and to display the application GUI. * * <p>Multitasking note: This method is called from an event-handler in the Splash_Controller, * which means that it is on the JavaFX Application Thread, which means that it is allowed to work * with GUI components. http://docs.oracle.com/javafx/2/threads/jfxpub-threads.htm */ public void startApp() { // Stage appStage = new Stage(); serverStage = new Stage(); // Resources are now initialized ServiceLocator sl = ServiceLocator.getServiceLocator(); Translator t = sl.getTranslator(); System.out.println("BLABLA"); try { final URL fxmlURL = getClass().getResource("/Server/Server.fxml"); // FXML-File from the ClientLogin-Window final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL); fxmlLoader.setController(new Server_Controller()); final Parent root = fxmlLoader.load(); Scene scene = new Scene(root, 650, 450); // scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); serverStage.setScene(scene); serverStage.setTitle(t.getString("program.name.windowName")); serverStage.show(); String zwischenstatus = fxmlURL.toString(); System.out.println("Application FXML Loader Pfad ist: " + zwischenstatus); } catch (Exception e) { e.printStackTrace(); } // Close the splash screen, and set the reference to null, so that all // Splash_XXX objects can be garbage collected splashView.stop(); splashView = null; // view.start(); }
/** * This method is called after init(), and is called on the JavaFX Application Thread, so we can * display a GUI. We have two GUIs: a splash screen and the application. Both of these follow the * MVC model. * * <p>We first display the splash screen. The model is where all initialization for the * application takes place. The controller updates a progress-bar in the view, and (after * initialization is finished) calls the startApp() method in this class. */ @Override public void start(Stage primaryStage) { // Create and display the splash screen and model Splash_Model splashModel = new Splash_Model(); splashView = new Splash_View(primaryStage, splashModel); new Splash_Controller(this, splashModel, splashView); splashView.start(); // Display the splash screen and begin the initialization splashModel.initialize(); }