button.addActionListener(new ActionListener() {
BField r;
public void actionPerformed(ActionEvent e) {
if(player1.hasTurn()){
System.out.println("Player1");
try{
board.setDataAt(row+1, col+1,r.X );
}catch(TakenException t){
}catch(InvalidRowColumnException z){
System.out.println("Hal");
}
button.setLabel("X");...Geht nicht
player1.setTurn(false);
player2.setTurn(true);
}else{
System.out.println("Player2");
try{
board.setDataAt(row+1, col+1,r.O );
}catch(TakenException t){
}catch(InvalidRowColumnException z){
}
player1.setTurn(true);
player2.setTurn(false);
}
rules.checkGameState(board.getBoard());
if(rules.getBoardState().equals(GameState.HumanWins)){
System.out.println("Hallo");
dialog(1);
}
}
});