From 3ee1d988c3bfb96f077a18cddddd092aab86a952 Mon Sep 17 00:00:00 2001 From: TRC9696 Date: Mon, 30 Jan 2023 17:10:24 +0100 Subject: [PATCH] Added functionality on button press for the fourth 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 a435a33..fd58583 100644 --- a/src/main/java/game/StartTicTacToeGame.java +++ b/src/main/java/game/StartTicTacToeGame.java @@ -203,5 +203,23 @@ public class StartTicTacToeGame implements ActionListener{ player2button3Pressed = true; } } + else if(e.getSource() == button4) { + if(player1Turn) { + button4.setForeground(Color.black); + button4.setText("X"); + button4.setFont(new Font("arial", Font.PLAIN, 30)); + player2Turn(); + button4.setEnabled(false); + player1button4Pressed = true; + } + else { + button4.setForeground(Color.black); + button4.setText("O"); + button4.setFont(new Font("arial", Font.PLAIN, 30)); + player1Turn(); + button4.setEnabled(false); + player2button4Pressed = true; + } + } } } \ No newline at end of file