From 7ed5d2c7671581207f7667f1bf701c66b4c185b3 Mon Sep 17 00:00:00 2001 From: Ozan-Can Ekinci Date: Thu, 12 Jan 2023 01:31:41 +0100 Subject: [PATCH] refactoring: calling methods in loadNextQuestion class --- src/main/java/game/loadNextQuestion.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/game/loadNextQuestion.java b/src/main/java/game/loadNextQuestion.java index 60bca5e..6c69b67 100644 --- a/src/main/java/game/loadNextQuestion.java +++ b/src/main/java/game/loadNextQuestion.java @@ -7,6 +7,9 @@ import Gui.GameGui; public class loadNextQuestion implements ActionListener { + GameGui gameStatus = new GameGui(); + runGame StartGame = new runGame(); + @Override public void actionPerformed(ActionEvent e) { @@ -48,18 +51,15 @@ public class loadNextQuestion implements ActionListener { public void loadQuestions() { if (GameGui.questionNr != runGame.arrQuestions.length - 1) { - runGame StartGame = new runGame(); StartGame.run(GameGui.questionNr); } else { - GameGui gameWin = new GameGui (); - gameWin.createWinningPanel(); + gameStatus.createWinningPanel(); } } public void wrongAnswer() { - GameGui gameLose = new GameGui(); - gameLose.createLosingPanel(); - gameLose.createRestartButton(); + gameStatus.createLosingPanel(); + gameStatus.createRestartButton(); } }