Browse Source

implemented restart button function

master
Ozan-Can Ekinci 2 years ago
parent
commit
0de9b669f8
  1. 1
      src/main/java/Gui/GameGui.java
  2. 20
      src/main/java/Gui/RestartGame.java
  3. 1
      src/main/java/game/loadNextQuestion.java
  4. 19
      target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
  5. 6
      target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst

1
src/main/java/Gui/GameGui.java

@ -131,5 +131,6 @@ GridBagConstraints gbc;
public void createRestartButton() { public void createRestartButton() {
RestartBtn = new JButton("Neustarten"); RestartBtn = new JButton("Neustarten");
LosingPanel.add(RestartBtn); LosingPanel.add(RestartBtn);
RestartBtn.addActionListener(new RestartGame());
} }
} }

20
src/main/java/Gui/RestartGame.java

@ -0,0 +1,20 @@
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();
}
}

1
src/main/java/game/loadNextQuestion.java

@ -59,6 +59,7 @@ public class loadNextQuestion implements ActionListener {
public void wrongAnswer() { public void wrongAnswer() {
GameGui gameLose = new GameGui(); GameGui gameLose = new GameGui();
gameLose.createLosingPanel(); gameLose.createLosingPanel();
gameLose.createRestartButton();
} }
} }

19
target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@ -1,9 +1,10 @@
C:\Users\Leon\MiniGameProject\src\main\java\Gui\ActionHandler.java
C:\Users\Leon\MiniGameProject\src\main\java\game\loadNextQuestion.java
C:\Users\Leon\MiniGameProject\src\main\java\Gui\GameGuiInterface.java
C:\Users\Leon\MiniGameProject\src\main\java\Gui\gui.java
C:\Users\Leon\MiniGameProject\src\main\java\game\runGame.java
C:\Users\Leon\MiniGameProject\src\main\java\main.java
C:\Users\Leon\MiniGameProject\src\main\java\Gui\StartGameGui.java
C:\Users\Leon\MiniGameProject\src\main\java\Gui\GameGui.java
C:\Users\Leon\MiniGameProject\src\main\java\Gui\GuiInterface.java
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
C:\Users\ozan_\MiniGameProject\src\main\java\Gui\ActionHandler.java
C:\Users\ozan_\MiniGameProject\src\main\java\main.java
C:\Users\ozan_\MiniGameProject\src\main\java\game\runGame.java
C:\Users\ozan_\MiniGameProject\src\main\java\Gui\StartGameGui.java
C:\Users\ozan_\MiniGameProject\src\main\java\Gui\GameGui.java

6
target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst

@ -1,3 +1,3 @@
C:\Users\Leon\MiniGameProject\src\test\java\Gui\guiTest.java
C:\Users\Leon\MiniGameProject\src\test\java\Gui\GameGuiTest.java
C:\Users\Leon\MiniGameProject\src\test\java\game\runGameTest.java
C:\Users\ozan_\MiniGameProject\src\test\java\Gui\GameGuiTest.java
C:\Users\ozan_\MiniGameProject\src\test\java\game\runGameTest.java
C:\Users\ozan_\MiniGameProject\src\test\java\Gui\guiTest.java
Loading…
Cancel
Save