Browse Source

refactoring: renamed player2Won to player2WonTheGame

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

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

@ -332,7 +332,7 @@ public class StartTicTacToeGame implements ActionListener{
backButton.setVisible(true); backButton.setVisible(true);
} }
public void player2Won() {
public void player2WonTheGame() {
label.setText("Spieler 2 hat gewonnen."); label.setText("Spieler 2 hat gewonnen.");
label.setBounds(250,20,500,50); label.setBounds(250,20,500,50);
fieldButton.setVisible(false); fieldButton.setVisible(false);
@ -379,31 +379,31 @@ public class StartTicTacToeGame implements ActionListener{
} }
if(player2fieldButtonPressed && player2fieldButton2Pressed && player2fieldButton3Pressed) { if(player2fieldButtonPressed && player2fieldButton2Pressed && player2fieldButton3Pressed) {
player2Won();
player2WonTheGame();
} }
else if(player2fieldButton4Pressed && player2fieldButton5Pressed && player2fieldButton6Pressed) { else if(player2fieldButton4Pressed && player2fieldButton5Pressed && player2fieldButton6Pressed) {
player2Won();
player2WonTheGame();
} }
else if(player2fieldButton7Pressed && player2fieldButton8Pressed && player2fieldButton9Pressed) { else if(player2fieldButton7Pressed && player2fieldButton8Pressed && player2fieldButton9Pressed) {
player2Won();
player2WonTheGame();
} }
else if(player2fieldButtonPressed && player2fieldButton5Pressed && player2fieldButton6Pressed) { else if(player2fieldButtonPressed && player2fieldButton5Pressed && player2fieldButton6Pressed) {
player2Won();
player2WonTheGame();
} }
else if(player2fieldButtonPressed && player2fieldButton4Pressed && player2fieldButton7Pressed) { else if(player2fieldButtonPressed && player2fieldButton4Pressed && player2fieldButton7Pressed) {
player2Won();
player2WonTheGame();
} }
else if(player2fieldButton2Pressed && player2fieldButton5Pressed && player2fieldButton8Pressed) { else if(player2fieldButton2Pressed && player2fieldButton5Pressed && player2fieldButton8Pressed) {
player2Won();
player2WonTheGame();
} }
else if(player2fieldButton3Pressed && player2fieldButton6Pressed && player2fieldButton9Pressed) { else if(player2fieldButton3Pressed && player2fieldButton6Pressed && player2fieldButton9Pressed) {
player2Won();
player2WonTheGame();
} }
else if(player2fieldButtonPressed && player2fieldButton5Pressed && player2fieldButton9Pressed) { else if(player2fieldButtonPressed && player2fieldButton5Pressed && player2fieldButton9Pressed) {
player2Won();
player2WonTheGame();
} }
else if(player2fieldButton3Pressed && player2fieldButton5Pressed && player2fieldButton7Pressed) { else if(player2fieldButton3Pressed && player2fieldButton5Pressed && player2fieldButton7Pressed) {
player2Won();
player2WonTheGame();
} }
} }
} }
Loading…
Cancel
Save