Browse Source

Added functionality on button press for the third button

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

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

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