|
@ -93,11 +93,23 @@ public class TicTacToeGame implements ActionListener { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//method if player X wins |
|
|
private void xWin(int i, int i1, int i2) { |
|
|
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 |
|
|
//Method for performing action after every turn |
|
|
@Override |
|
|
@Override |
|
|
public void actionPerformed(ActionEvent e) { |
|
|
public void actionPerformed(ActionEvent e) { |
|
|