|
@ -149,7 +149,24 @@ public class StartTicTacToeGame implements ActionListener{ |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void actionPerformed(ActionEvent e) { |
|
|
public void actionPerformed(ActionEvent e) { |
|
|
// TODO Auto-generated method stub |
|
|
|
|
|
|
|
|
if(e.getSource() == button) { |
|
|
|
|
|
if(player1Turn) { |
|
|
|
|
|
button.setForeground(Color.black); |
|
|
|
|
|
button.setText("X"); |
|
|
|
|
|
button.setFont(new Font("arial", Font.PLAIN, 30)); |
|
|
|
|
|
player2Turn(); |
|
|
|
|
|
button.setEnabled(false); |
|
|
|
|
|
player1buttonPressed = true; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
button.setForeground(Color.black); |
|
|
|
|
|
button.setText("O"); |
|
|
|
|
|
button.setFont(new Font("arial", Font.PLAIN, 30)); |
|
|
|
|
|
button.setEnabled(false); |
|
|
|
|
|
player1Turn(); |
|
|
|
|
|
player2buttonPressed = true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |