From df6e4e8a61aa2577f47378e3a4101a082496b9e0 Mon Sep 17 00:00:00 2001 From: TRC9696 Date: Mon, 30 Jan 2023 17:21:10 +0100 Subject: [PATCH] Added functionality on button press for the ninth button --- src/main/java/game/StartTicTacToeGame.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/game/StartTicTacToeGame.java b/src/main/java/game/StartTicTacToeGame.java index d39024a..509b635 100644 --- a/src/main/java/game/StartTicTacToeGame.java +++ b/src/main/java/game/StartTicTacToeGame.java @@ -293,5 +293,23 @@ public class StartTicTacToeGame implements ActionListener{ player2button8Pressed = true; } } + else if(e.getSource() == button9) { + if(player1Turn) { + button9.setForeground(Color.black); + button9.setText("X"); + button9.setFont(new Font("arial", Font.PLAIN, 30)); + player2Turn(); + button9.setEnabled(false); + player1button9Pressed = true; + } + else { + button9.setForeground(Color.black); + button9.setText("O"); + button9.setFont(new Font("arial", Font.PLAIN, 30)); + button9.setEnabled(false); + player1Turn(); + player2button9Pressed = true; + } + } } } \ No newline at end of file