diff --git a/src/main/java/game/loadNextQuestion.java b/src/main/java/game/loadNextQuestion.java index b38c8cb..bedc45d 100644 --- a/src/main/java/game/loadNextQuestion.java +++ b/src/main/java/game/loadNextQuestion.java @@ -12,49 +12,45 @@ public class loadNextQuestion implements ActionListener { if (runGame.splitAns[4].equals("1")) { if (e.getSource() == GameGui.AnswersBtn1) { - if (GameGui.questionNr != runGame.arrQuestions.length - 1) { - runGame StartGame = new runGame(); - StartGame.run(GameGui.questionNr); - } + loadQuestions(); } else { System.exit(0); } } + else if (runGame.splitAns[4].equals("2")) { if (e.getSource() == GameGui.AnswersBtn2) { - if (GameGui.questionNr != runGame.arrQuestions.length - 1) { - runGame StartGame = new runGame(); - StartGame.run(GameGui.questionNr); - } + loadQuestions(); } else { System.exit(0); } } + else if (runGame.splitAns[4].equals("3")) { if (e.getSource() == GameGui.AnswersBtn3) { - if (GameGui.questionNr != runGame.arrQuestions.length - 1) { - runGame StartGame = new runGame(); - StartGame.run(GameGui.questionNr); - } + loadQuestions(); } else { System.exit(0); } } + else if (runGame.splitAns[4].equals("4")) { if (e.getSource() == GameGui.AnswersBtn4) { - if (GameGui.questionNr != runGame.arrQuestions.length - 1) { - runGame StartGame = new runGame(); - StartGame.run(GameGui.questionNr); - } + loadQuestions(); } else { System.exit(0); } } - + } - } + public void loadQuestions() { + if (GameGui.questionNr != runGame.arrQuestions.length - 1) { + runGame StartGame = new runGame(); + StartGame.run(GameGui.questionNr); + } + } -} + }