Browse Source

Added functionality on button press for the ninth button

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

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

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