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