@Override public void start(Stage stage) throws Exception { FXMLLoader LOADER = new FXMLLoader(getClass().getResource("/view/createServer.fxml")); // Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml")); -- original LOC // when framed Parent root = (Parent) LOADER.load(); createServer_controller_no_use controller = (createServer_controller_no_use) LOADER.getController(); controller.init(stage); Scene scene = new Scene(root); // stage.initStyle(StageStyle.UNDECORATED); -- Not to use all 3 buttons ->min,max,close // stage.initStyle(StageStyle.UTILITY); -- Only use close not min and max stage.resizableProperty().setValue(Boolean.FALSE); // Use min and close not max stage.setTitle("Jishnu Offline Typeracer"); stage.setScene(scene); stage.getIcons().add(new Image("file:pics/server.png")); stage.show(); }
/** displays the new character views */ @FXML private void showNewChar() { try { FXMLLoader loader = new FXMLLoader(); loader.setLocation(this.getClass().getResource("dialogs/NewCharacterDialog.fxml")); AnchorPane page = (AnchorPane) loader.load(); // Create the dialog Stage. Stage dialogStage = new Stage(); dialogStage.setTitle("Create New Character"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initStyle(StageStyle.UTILITY); dialogStage.initOwner(this.getInterface().getPrimaryStage()); dialogStage.resizableProperty().set(false); Scene scene = new Scene(page); dialogStage.setScene(scene); // Set the person into the controller. NewCharacterController controller = loader.getController(); controller.setDialogStage(dialogStage); controller.setInterface(getInterface()); controller.loadPartials(); dialogStage .onCloseRequestProperty() .set( (EventHandler<WindowEvent>) (WindowEvent event) -> { controller.handleCancel(null); }); // Show the dialog and wait until the user closes it dialogStage.showAndWait(); if (controller.getCharacter() != null) ((RootController) this.getRoot()).setCharacter(controller.getCharacter()); } catch (IOException e) { e.printStackTrace(); } }