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