Skip to content
Snippets Groups Projects
Commit 3c451fa6 authored by jan-schw's avatar jan-schw
Browse files

add event handler to grid instead of button

parent 1b7b47b2
No related branches found
No related tags found
2 merge requests!6Add final version of the game to main branch,!5Add basic implementation
......@@ -49,11 +49,11 @@ public class TicTacToeFX extends Application {
button.setPrefSize(100, 100); // Größe der Buttons
grid.add(button, col, row); // Hinzufügen zum Grid
buttons[row][col] = button;
button.addEventHandler(GameEvent.VICTORY_EVENT, gameEventHandler);
button.addEventHandler(GameEvent.DRAW_EVENT, gameEventHandler);
button.setOnAction(event -> handleButtonClick(button));
}
}
grid.addEventHandler(GameEvent.VICTORY_EVENT, gameEventHandler);
grid.addEventHandler(GameEvent.DRAW_EVENT, gameEventHandler);
// Szene und Stage erstellen
Scene scene1 = new Scene(grid, 300, 300); // Größe der Szene
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment