diff --git a/src/main/java/Gui/ActionHandler.java b/src/main/java/Gui/ActionHandler.java index 070d9e3..e32747c 100644 --- a/src/main/java/Gui/ActionHandler.java +++ b/src/main/java/Gui/ActionHandler.java @@ -5,6 +5,8 @@ import java.awt.event.ActionListener; public class ActionHandler implements ActionListener { + StartGameGui restartGame = new StartGameGui(); + public void actionPerformed(ActionEvent e) { if (e.getSource() == gui.CloseBtn) { System.exit(0); @@ -14,6 +16,10 @@ public class ActionHandler implements ActionListener { System.exit(0); } + GameGui.questionNr = 0; + GameGui.LosingPanel.setVisible(false); + restartGame.startGame(); + } } diff --git a/src/main/java/Gui/GameGui.java b/src/main/java/Gui/GameGui.java index 065dfe9..bc8c125 100644 --- a/src/main/java/Gui/GameGui.java +++ b/src/main/java/Gui/GameGui.java @@ -143,7 +143,7 @@ GridBagConstraints gbc; LosingPanel.add(RestartBtn,gbc); LosingPanel.add(ClosingBtn,gbc); - RestartBtn.addActionListener(new RestartGame()); + RestartBtn.addActionListener(new ActionHandler()); ClosingBtn.addActionListener(new ActionHandler()); } } diff --git a/src/main/java/Gui/RestartGame.java b/src/main/java/Gui/RestartGame.java deleted file mode 100644 index 83ee38c..0000000 --- a/src/main/java/Gui/RestartGame.java +++ /dev/null @@ -1,20 +0,0 @@ -package Gui; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -public class RestartGame implements ActionListener { - - StartGameGui restartGame = new StartGameGui(); - - @Override - public void actionPerformed(ActionEvent e) { - - GameGui.questionNr = 0; - GameGui.LosingPanel.setVisible(false); - restartGame.startGame(); - - - } - -} diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index aa9ecc7..b7c28cf 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,5 +1,4 @@ C:\Users\ozan_\MiniGameProject\src\main\java\Gui\GuiInterface.java -C:\Users\ozan_\MiniGameProject\src\main\java\Gui\RestartGame.java C:\Users\ozan_\MiniGameProject\src\main\java\Gui\GameGuiInterface.java C:\Users\ozan_\MiniGameProject\src\main\java\Gui\gui.java C:\Users\ozan_\MiniGameProject\src\main\java\game\loadNextQuestion.java