/** * Make an event handler to remove the mot from the liste de mot en consultation when the window * is closed * * @param stageConsult * @param subController */ private void setConsultWindowCloseHandler(Stage stageConsult, FXMLController_2 subController) { // Make an event handler to remove the mot from the liste de mot en consultation // when the stage is closed EventHandler<WindowEvent> windowEventHandlerConsult = new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { event.consume(); model.supprimerMotEnConsultation(subController.motAConsulter); stageConsult.close(); } }; stageConsult.addEventHandler(WindowEvent.WINDOW_CLOSE_REQUEST, windowEventHandlerConsult); }
@Override public void start(Stage primaryStage) { this.primaryStage = primaryStage; this.primaryStage.setTitle("SudokuSolver"); primaryStage.setResizable(false); // Set the application icon. this.primaryStage.getIcons().add(new Image("file:resources/images/sudoku.png")); int[][] sudokuFeld = new int[9][9]; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { sudokuFeld[i][j] = 0; } } sudoku = new Sudoku(sudokuFeld); initRootLayout(); initSudokuLayout(); primaryStage.addEventHandler(KeyEvent.KEY_PRESSED, scontroller.keyEventHandler); }