Browse Source

refactoring: Replace RestartBtn Name

master
Leon Montag 2 years ago
parent
commit
d8c79f46ad
  1. 4
      src/main/java/Gui/ActionHandler.java
  2. 14
      src/main/java/Gui/GameGui.java
  3. 18
      target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
  4. 6
      target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst

4
src/main/java/Gui/ActionHandler.java

@ -16,14 +16,14 @@ public class ActionHandler implements ActionListener {
System.exit(0); System.exit(0);
} }
if (e.getSource() == GameGui.RestartBtn) {
if (e.getSource() == GameGui.LosingRestartBtn) {
GameGui.questionNr = 0; GameGui.questionNr = 0;
GameGui.LosingPanel.setVisible(false); GameGui.LosingPanel.setVisible(false);
GameGui.currentQuestion = 1; GameGui.currentQuestion = 1;
restartGame.startGame(); restartGame.startGame();
} }
if (e.getSource() == GameGui.RestartBtn1) {
if (e.getSource() == GameGui.WinningRestartBtn) {
GameGui.questionNr = 0; GameGui.questionNr = 0;
GameGui.WinningPanel.setVisible(false); GameGui.WinningPanel.setVisible(false);
GameGui.currentQuestion = 1; GameGui.currentQuestion = 1;

14
src/main/java/Gui/GameGui.java

@ -17,7 +17,7 @@ public class GameGui implements GameGuiInterface {
public static JPanel MainPanel, ButtonPanel, HeadingPanel, WinningPanel, LosingPanel; public static JPanel MainPanel, ButtonPanel, HeadingPanel, WinningPanel, LosingPanel;
public static JLabel HeadlineLabel, QuestionLabel, WinningLabel, LosingLabel, CurrentQuestionNrLabel, HighScoreLabel; public static JLabel HeadlineLabel, QuestionLabel, WinningLabel, LosingLabel, CurrentQuestionNrLabel, HighScoreLabel;
public static JButton AnswersBtn1, AnswersBtn2, AnswersBtn3, AnswersBtn4, RestartBtn, RestartBtn1, ClosingBtn;
public static JButton AnswersBtn1, AnswersBtn2, AnswersBtn3, AnswersBtn4, LosingRestartBtn, WinningRestartBtn, ClosingBtn;
public static int questionNr = 0; public static int questionNr = 0;
public static int currentQuestion = 1; public static int currentQuestion = 1;
public static int highScore = 0; public static int highScore = 0;
@ -55,7 +55,7 @@ public class GameGui implements GameGuiInterface {
gbc.ipady = 100; gbc.ipady = 100;
gbc.insets = new Insets(20, 0, 0, 0); gbc.insets = new Insets(20, 0, 0, 0);
RestartBtn = new JButton("Neustarten");
LosingRestartBtn = new JButton("Neustarten");
ClosingBtn = new JButton("Schliessen"); ClosingBtn = new JButton("Schliessen");
LosingPanel = new JPanel(); LosingPanel = new JPanel();
@ -67,9 +67,9 @@ public class GameGui implements GameGuiInterface {
LosingLabel.setFont(new Font("Serif", Font.BOLD, 28)); LosingLabel.setFont(new Font("Serif", Font.BOLD, 28));
LosingPanel.add(LosingLabel, gbc); LosingPanel.add(LosingLabel, gbc);
LosingPanel.add(RestartBtn, gbc);
LosingPanel.add(LosingRestartBtn, gbc);
LosingPanel.add(ClosingBtn, gbc); LosingPanel.add(ClosingBtn, gbc);
RestartBtn.addActionListener(new ActionHandler());
LosingRestartBtn.addActionListener(new ActionHandler());
ClosingBtn.addActionListener(new ActionHandler()); ClosingBtn.addActionListener(new ActionHandler());
gui.Frame.add(LosingPanel); gui.Frame.add(LosingPanel);
} }
@ -85,7 +85,7 @@ public class GameGui implements GameGuiInterface {
gbc.ipady = 100; gbc.ipady = 100;
gbc.insets = new Insets(20, 0, 0, 0); gbc.insets = new Insets(20, 0, 0, 0);
RestartBtn1 = new JButton("Nochmal Spielen");
WinningRestartBtn = new JButton("Nochmal Spielen");
ClosingBtn = new JButton("Schliessen"); ClosingBtn = new JButton("Schliessen");
WinningPanel = new JPanel(); WinningPanel = new JPanel();
@ -96,9 +96,9 @@ public class GameGui implements GameGuiInterface {
WinningLabel.setFont(new Font("Serif", Font.BOLD, 34)); WinningLabel.setFont(new Font("Serif", Font.BOLD, 34));
WinningPanel.add(WinningLabel, gbc); WinningPanel.add(WinningLabel, gbc);
WinningPanel.add(RestartBtn1, gbc);
WinningPanel.add(WinningRestartBtn, gbc);
WinningPanel.add(ClosingBtn, gbc); WinningPanel.add(ClosingBtn, gbc);
RestartBtn1.addActionListener(new ActionHandler());
WinningRestartBtn.addActionListener(new ActionHandler());
ClosingBtn.addActionListener(new ActionHandler()); ClosingBtn.addActionListener(new ActionHandler());
gui.Frame.add(WinningPanel); gui.Frame.add(WinningPanel);
} }

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

@ -1,9 +1,9 @@
C:\Users\ozan_\MiniGameProject\src\main\java\Gui\GuiInterface.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
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

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

@ -1,3 +1,3 @@
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
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
Loading…
Cancel
Save