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);
@ -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());

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

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

Loading…
Cancel
Save