Browse Source

refactoring: renamed player1Won to player1WonTheGame

master
TRC9696 2 years ago
parent
commit
599e5ae027
  1. 20
      src/main/java/game/StartTicTacToeGame.java

20
src/main/java/game/StartTicTacToeGame.java

@ -315,7 +315,7 @@ public class StartTicTacToeGame implements ActionListener{
}
}
public void player1Won() {
public void player1WonTheGame() {
label.setText("Spieler 1 hat gewonnen.");
label.setBounds(250,20,500,50);
fieldButton.setVisible(false);
@ -351,31 +351,31 @@ public class StartTicTacToeGame implements ActionListener{
public void check() {
if(player1fieldButtonPressed && player1fieldButton2Pressed && player1fieldButton3Pressed) {
player1Won();
player1WonTheGame();
}
else if(player1fieldButton4Pressed && player1fieldButton5Pressed && player1fieldButton6Pressed) {
player1Won();
player1WonTheGame();
}
else if(player1fieldButton7Pressed && player1fieldButton8Pressed && player1fieldButton9Pressed) {
player1Won();
player1WonTheGame();
}
else if(player1fieldButtonPressed && player1fieldButton5Pressed && player1fieldButton6Pressed) {
player1Won();
player1WonTheGame();
}
else if(player1fieldButtonPressed && player1fieldButton4Pressed && player1fieldButton7Pressed) {
player1Won();
player1WonTheGame();
}
else if(player1fieldButton2Pressed && player1fieldButton5Pressed && player1fieldButton8Pressed) {
player1Won();
player1WonTheGame();
}
else if(player1fieldButton3Pressed && player1fieldButton6Pressed && player1fieldButton9Pressed) {
player1Won();
player1WonTheGame();
}
else if(player1fieldButtonPressed && player1fieldButton5Pressed && player1fieldButton9Pressed) {
player1Won();
player1WonTheGame();
}
else if(player1fieldButton3Pressed && player1fieldButton5Pressed && player1fieldButton7Pressed) {
player1Won();
player1WonTheGame();
}
if(player2fieldButtonPressed && player2fieldButton2Pressed && player2fieldButton3Pressed) {

Loading…
Cancel
Save