Browse Source

Added functionality on button press for the first button

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

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