Browse Source

added GridBagLayout for restart button

master
Ozan-Can Ekinci 2 years ago
parent
commit
e2bcd2a2fc
  1. 8
      src/main/java/Gui/GameGui.java

8
src/main/java/Gui/GameGui.java

@ -46,7 +46,8 @@ GridBagConstraints gbc;
public void createLosingPanel() {
MainPanel.setVisible(false);
ButtonPanel.setVisible(false);
LosingPanel = new JPanel(new GridLayout());
LosingPanel = new JPanel();
LosingPanel.setLayout(new GridBagLayout());
LosingLabel = new JLabel("Du hast Verloren!");
LosingLabel.setVerticalAlignment(JLabel.CENTER);
LosingLabel.setHorizontalAlignment(JLabel.CENTER);
@ -129,8 +130,11 @@ GridBagConstraints gbc;
@Override
public void createRestartButton() {
GridBagConstraints gbc = new GridBagConstraints();
RestartBtn = new JButton("Neustarten");
LosingPanel.add(RestartBtn);
LosingPanel.add(LosingLabel,gbc);
LosingPanel.add(RestartBtn,gbc);
RestartBtn.addActionListener(new RestartGame());
}
}
Loading…
Cancel
Save