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 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);
@ -55,7 +66,6 @@ GridBagConstraints gbc;
WinningPanel.setVisible(true);
}
@Override
public void createHeadline() {
Headline = new JLabel("Wer wird Millionär?");
@ -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());

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

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

Loading…
Cancel
Save