From 599cf62ce796e3e1f4565cebceb316711f3d3e96 Mon Sep 17 00:00:00 2001 From: Ozan-Can Ekinci Date: Tue, 10 Jan 2023 18:57:32 +0100 Subject: [PATCH] created losingpanel method --- src/main/java/Gui/GameGui.java | 18 +++++++++++++++--- src/main/java/Gui/GameGuiInterface.java | 2 ++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/Gui/GameGui.java b/src/main/java/Gui/GameGui.java index 643edfd..32af424 100644 --- a/src/main/java/Gui/GameGui.java +++ b/src/main/java/Gui/GameGui.java @@ -15,8 +15,8 @@ import game.loadNextQuestion; public class GameGui implements GameGuiInterface { -public static JPanel MainPanel, ButtonPanel, headingPanel, WinningPanel; -public static JLabel Headline,QuestionLabel,WinningLabel; +public static JPanel MainPanel, ButtonPanel, headingPanel, WinningPanel, LosingPanel; +public static JLabel Headline,QuestionLabel,WinningLabel, LosingLabel; public static JButton AnswersBtn1,AnswersBtn2,AnswersBtn3,AnswersBtn4; public static int questionNr = 0; GridLayout grid; @@ -41,6 +41,17 @@ GridBagConstraints gbc; headingPanel.setLayout(grid); gui.Frame.add(MainPanel); } + + @Override + public void createLosingPanel() { + MainPanel.setVisible(false); + ButtonPanel.setVisible(false); + LosingPanel = new JPanel(); + LosingLabel = new JLabel("Du hast Verloren!"); + LosingPanel.add(LosingLabel); + gui.Frame.add(LosingPanel); + } + @Override public void createWinningPanel() { GameGui.MainPanel.setVisible(false); @@ -54,7 +65,6 @@ GridBagConstraints gbc; gui.Frame.add(WinningPanel); WinningPanel.setVisible(true); } - @Override public void createHeadline() { @@ -64,6 +74,7 @@ GridBagConstraints gbc; Headline.setHorizontalAlignment(JLabel.CENTER); Headline.setFont(new Font("Serif", Font.BOLD, 28)); } + @Override public void createQuestionLabel() { QuestionLabel = new JLabel("Questions"); @@ -72,6 +83,7 @@ GridBagConstraints gbc; QuestionLabel.setVerticalAlignment(JLabel.NORTH); headingPanel.add(QuestionLabel); } + @Override public void createLayout() { ButtonPanel.setLayout(new GridBagLayout()); diff --git a/src/main/java/Gui/GameGuiInterface.java b/src/main/java/Gui/GameGuiInterface.java index 2802b66..78d9657 100644 --- a/src/main/java/Gui/GameGuiInterface.java +++ b/src/main/java/Gui/GameGuiInterface.java @@ -7,6 +7,8 @@ public interface GameGuiInterface { void CreatePanel(); void createWinningPanel(); + + void createLosingPanel(); void createHeadline();