@FXML private void handleBackButton(ActionEvent event) { try { Parent root = FXMLLoader.load(getClass().getResource(GAMESELECT1)); Stage stage = ((Stage) ((Node) event.getSource()).getScene().getWindow()); scale.scaleInterface(root); stage.sceneProperty().get().setRoot(root); } catch (IOException ex) { System.out.println("invalid uri"); } }
private void startGame(int level) { try { FileManager.saveLevel(level); Parent root = null; switch (selectedGame) { case "wordex": root = FXMLLoader.load(getClass().getResource(WORDEX)); break; case "wordsearch": root = FXMLLoader.load(getClass().getResource(WORD_SEARCH)); break; case "splitwords": root = FXMLLoader.load(getClass().getResource(SPLIT_WORDS)); break; case "wordsFromALetter": root = FXMLLoader.load(getClass().getResource(WORDS_FROM_A_LETTER)); break; case "correctSpelling": root = FXMLLoader.load(getClass().getResource(CORRECT_SPELLING)); break; case "correctSpelling2": root = FXMLLoader.load(getClass().getResource(CORRECT_SPELLING2)); break; case "namesAnimalsPlants": root = FXMLLoader.load(getClass().getResource(NAMES_ANIMALS_PLANTS)); break; case "coloredBoxes": root = FXMLLoader.load(getClass().getResource(COLORED_BOXES)); break; case "matchCards": root = FXMLLoader.load(getClass().getResource(MATCH_CARDS)); break; case "faceNameHouse": root = FXMLLoader.load(getClass().getResource(FACE_NAME_HOUSE)); break; } scale.scaleInterface(root); Stage stage = ((Stage) gameLabel.getScene().getWindow()); stage.sceneProperty().get().setRoot(root); } catch (IOException ex) { Logger.getLogger(GameSelectController.class.getName()).log(Level.SEVERE, null, ex); } }