Browse Source

Tic Tac Toe creating method if player x wins

remotes/origin/develop
fdai6040 2 years ago
parent
commit
4d2b578606
  1. 12
      src/main/java/src/TicTacToeGame.java

12
src/main/java/src/TicTacToeGame.java

@ -93,11 +93,23 @@ public class TicTacToeGame implements ActionListener {
}
}
//method if player X wins
private void xWin(int i, int i1, int i2) {
bton[i].setBackground(Color.PINK);
bton[i1].setBackground(Color.PINK);
bton[i2].setBackground(Color.PINK);
for (int j = 0; j < 9; j++)
{
bton[j].setEnabled(false);
}
textfield.setText("Player X wins");
}
//Method for performing action after every turn
@Override
public void actionPerformed(ActionEvent e) {

Loading…
Cancel
Save