diff --git a/src/main/java/src/TicTacToeGame.java b/src/main/java/src/TicTacToeGame.java index 58ada26..4da2ea2 100644 --- a/src/main/java/src/TicTacToeGame.java +++ b/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) {