Browse Source

Added functionality on button press for the fourth button

master
TRC9696 2 years ago
parent
commit
3ee1d988c3
  1. 18
      src/main/java/game/StartTicTacToeGame.java

18
src/main/java/game/StartTicTacToeGame.java

@ -203,5 +203,23 @@ public class StartTicTacToeGame implements ActionListener{
player2button3Pressed = true; player2button3Pressed = true;
} }
} }
else if(e.getSource() == button4) {
if(player1Turn) {
button4.setForeground(Color.black);
button4.setText("X");
button4.setFont(new Font("arial", Font.PLAIN, 30));
player2Turn();
button4.setEnabled(false);
player1button4Pressed = true;
}
else {
button4.setForeground(Color.black);
button4.setText("O");
button4.setFont(new Font("arial", Font.PLAIN, 30));
player1Turn();
button4.setEnabled(false);
player2button4Pressed = true;
}
}
} }
} }
Loading…
Cancel
Save