From 7e7efdf9cfccda571c3eaf81939085f87dfcf941 Mon Sep 17 00:00:00 2001 From: TRC9696 Date: Mon, 30 Jan 2023 16:54:01 +0100 Subject: [PATCH] Added functionality on button press for the second button --- src/main/java/game/StartTicTacToeGame.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/game/StartTicTacToeGame.java b/src/main/java/game/StartTicTacToeGame.java index 1beec3e..2d5e82f 100644 --- a/src/main/java/game/StartTicTacToeGame.java +++ b/src/main/java/game/StartTicTacToeGame.java @@ -167,6 +167,23 @@ public class StartTicTacToeGame implements ActionListener{ player2buttonPressed = true; } } - + else if(e.getSource() == button2) { + if(player1Turn) { + button2.setForeground(Color.black); + button2.setText("X"); + button2.setFont(new Font("arial", Font.PLAIN, 30)); + player2Turn(); + button2.setEnabled(false); + player1button2Pressed = true; + } + else { + button2.setForeground(Color.black); + button2.setText("O"); + button2.setFont(new Font("arial", Font.PLAIN, 30)); + button2.setEnabled(false); + player1Turn(); + player2button2Pressed = true; + } + } } } \ No newline at end of file