Browse Source

Added functionality on button press for the second button

master
TRC9696 2 years ago
parent
commit
7e7efdf9cf
  1. 19
      src/main/java/game/StartTicTacToeGame.java

19
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;
}
}
}
}
Loading…
Cancel
Save