Browse Source

refactoring: calling methods in loadNextQuestion class

master
Ozan-Can Ekinci 2 years ago
parent
commit
7ed5d2c767
  1. 12
      src/main/java/game/loadNextQuestion.java

12
src/main/java/game/loadNextQuestion.java

@ -7,6 +7,9 @@ import Gui.GameGui;
public class loadNextQuestion implements ActionListener { public class loadNextQuestion implements ActionListener {
GameGui gameStatus = new GameGui();
runGame StartGame = new runGame();
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -48,18 +51,15 @@ public class loadNextQuestion implements ActionListener {
public void loadQuestions() { public void loadQuestions() {
if (GameGui.questionNr != runGame.arrQuestions.length - 1) { if (GameGui.questionNr != runGame.arrQuestions.length - 1) {
runGame StartGame = new runGame();
StartGame.run(GameGui.questionNr); StartGame.run(GameGui.questionNr);
} else { } else {
GameGui gameWin = new GameGui ();
gameWin.createWinningPanel();
gameStatus.createWinningPanel();
} }
} }
public void wrongAnswer() { public void wrongAnswer() {
GameGui gameLose = new GameGui();
gameLose.createLosingPanel();
gameLose.createRestartButton();
gameStatus.createLosingPanel();
gameStatus.createRestartButton();
} }
} }
Loading…
Cancel
Save