Browse Source

added restart and closing button after winning

master
Ozan-Can Ekinci 2 years ago
parent
commit
49de036b77
  1. 10
      src/main/java/Gui/GameGui.java

10
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 JPanel MainPanel, ButtonPanel, headingPanel, WinningPanel, LosingPanel;
public static JLabel Headline,QuestionLabel,WinningLabel, LosingLabel; public static JLabel Headline,QuestionLabel,WinningLabel, LosingLabel;
public static JButton AnswersBtn1,AnswersBtn2,AnswersBtn3,AnswersBtn4,RestartBtn,ClosingBtn;
public static JButton AnswersBtn1,AnswersBtn2,AnswersBtn3,AnswersBtn4,RestartBtn,RestartBtn1,ClosingBtn;
public static int questionNr = 0; public static int questionNr = 0;
GridLayout grid; GridLayout grid;
GridBagConstraints gbc; GridBagConstraints gbc;
@ -76,14 +76,20 @@ GridBagConstraints gbc;
public void createWinningPanel() { public void createWinningPanel() {
GameGui.MainPanel.setVisible(false); GameGui.MainPanel.setVisible(false);
GameGui.ButtonPanel.setVisible(false); GameGui.ButtonPanel.setVisible(false);
RestartBtn1 = new JButton("Nochmal Spielen");
ClosingBtn = new JButton("Schliessen");
WinningPanel = new JPanel(new GridLayout()); WinningPanel = new JPanel(new GridLayout());
WinningLabel = new JLabel("Du hast Gewonnen!"); WinningLabel = new JLabel("Du hast Gewonnen!");
WinningLabel.setVerticalAlignment(JLabel.CENTER); WinningLabel.setVerticalAlignment(JLabel.CENTER);
WinningLabel.setHorizontalAlignment(JLabel.CENTER); WinningLabel.setHorizontalAlignment(JLabel.CENTER);
WinningLabel.setFont(new Font("Serif", Font.BOLD, 28)); WinningLabel.setFont(new Font("Serif", Font.BOLD, 28));
WinningPanel.add(WinningLabel); WinningPanel.add(WinningLabel);
WinningPanel.add(RestartBtn1);
WinningPanel.add(ClosingBtn);
gui.Frame.add(WinningPanel); gui.Frame.add(WinningPanel);
WinningPanel.setVisible(true);
} }
@Override @Override

Loading…
Cancel
Save