From 2fa8f7e873396f6a4221097cc3cf07aa27d87755 Mon Sep 17 00:00:00 2001 From: TRC9696 Date: Mon, 30 Jan 2023 16:52:37 +0100 Subject: [PATCH] Added functionality on button press for the first 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 07e09b2..1beec3e 100644 --- a/src/main/java/game/StartTicTacToeGame.java +++ b/src/main/java/game/StartTicTacToeGame.java @@ -149,7 +149,24 @@ public class StartTicTacToeGame implements ActionListener{ @Override public void actionPerformed(ActionEvent e) { - // TODO Auto-generated method stub + if(e.getSource() == button) { + if(player1Turn) { + button.setForeground(Color.black); + button.setText("X"); + button.setFont(new Font("arial", Font.PLAIN, 30)); + player2Turn(); + button.setEnabled(false); + player1buttonPressed = true; + } + else { + button.setForeground(Color.black); + button.setText("O"); + button.setFont(new Font("arial", Font.PLAIN, 30)); + button.setEnabled(false); + player1Turn(); + player2buttonPressed = true; + } + } } } \ No newline at end of file