From 78b7b047b8fb1e22e3c74fcd512485268db938e4 Mon Sep 17 00:00:00 2001 From: Ozan-Can Ekinci Date: Wed, 11 Jan 2023 19:32:18 +0100 Subject: [PATCH] added restart button --- src/main/java/Gui/GameGui.java | 8 +++++++- src/main/java/Gui/GameGuiInterface.java | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/Gui/GameGui.java b/src/main/java/Gui/GameGui.java index c68c3fc..2c23bba 100644 --- a/src/main/java/Gui/GameGui.java +++ b/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 JLabel Headline,QuestionLabel,WinningLabel, LosingLabel; -public static JButton AnswersBtn1,AnswersBtn2,AnswersBtn3,AnswersBtn4; +public static JButton AnswersBtn1,AnswersBtn2,AnswersBtn3,AnswersBtn4,RestartBtn; public static int questionNr = 0; GridLayout grid; GridBagConstraints gbc; @@ -126,4 +126,10 @@ GridBagConstraints gbc; AnswersBtn4.addActionListener(new loadNextQuestion()); MainPanel.add(ButtonPanel); } + + @Override + public void createRestartButton() { + RestartBtn = new JButton("Neustarten"); + LosingPanel.add(RestartBtn); + } } diff --git a/src/main/java/Gui/GameGuiInterface.java b/src/main/java/Gui/GameGuiInterface.java index 78d9657..f0378b9 100644 --- a/src/main/java/Gui/GameGuiInterface.java +++ b/src/main/java/Gui/GameGuiInterface.java @@ -17,5 +17,7 @@ public interface GameGuiInterface { void createLayout(); void createButtons(); + + void createRestartButton(); } \ No newline at end of file