Browse Source

created losingpanel method

master
Ozan-Can Ekinci 2 years ago
parent
commit
599cf62ce7
  1. 18
      src/main/java/Gui/GameGui.java
  2. 2
      src/main/java/Gui/GameGuiInterface.java

18
src/main/java/Gui/GameGui.java

@ -15,8 +15,8 @@ import game.loadNextQuestion;
public class GameGui implements GameGuiInterface { 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 JButton AnswersBtn1,AnswersBtn2,AnswersBtn3,AnswersBtn4;
public static int questionNr = 0; public static int questionNr = 0;
GridLayout grid; GridLayout grid;
@ -41,6 +41,17 @@ GridBagConstraints gbc;
headingPanel.setLayout(grid); headingPanel.setLayout(grid);
gui.Frame.add(MainPanel); 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 @Override
public void createWinningPanel() { public void createWinningPanel() {
GameGui.MainPanel.setVisible(false); GameGui.MainPanel.setVisible(false);
@ -55,7 +66,6 @@ GridBagConstraints gbc;
WinningPanel.setVisible(true); WinningPanel.setVisible(true);
} }
@Override @Override
public void createHeadline() { public void createHeadline() {
Headline = new JLabel("Wer wird Millionär?"); Headline = new JLabel("Wer wird Millionär?");
@ -64,6 +74,7 @@ GridBagConstraints gbc;
Headline.setHorizontalAlignment(JLabel.CENTER); Headline.setHorizontalAlignment(JLabel.CENTER);
Headline.setFont(new Font("Serif", Font.BOLD, 28)); Headline.setFont(new Font("Serif", Font.BOLD, 28));
} }
@Override @Override
public void createQuestionLabel() { public void createQuestionLabel() {
QuestionLabel = new JLabel("Questions"); QuestionLabel = new JLabel("Questions");
@ -72,6 +83,7 @@ GridBagConstraints gbc;
QuestionLabel.setVerticalAlignment(JLabel.NORTH); QuestionLabel.setVerticalAlignment(JLabel.NORTH);
headingPanel.add(QuestionLabel); headingPanel.add(QuestionLabel);
} }
@Override @Override
public void createLayout() { public void createLayout() {
ButtonPanel.setLayout(new GridBagLayout()); ButtonPanel.setLayout(new GridBagLayout());

2
src/main/java/Gui/GameGuiInterface.java

@ -8,6 +8,8 @@ public interface GameGuiInterface {
void createWinningPanel(); void createWinningPanel();
void createLosingPanel();
void createHeadline(); void createHeadline();
void createQuestionLabel(); void createQuestionLabel();

Loading…
Cancel
Save