Browse Source

Beautified GUI Won Screen

fleetstorm
Lorenz Hohmann 3 years ago
parent
commit
d5d6af193e
  1. 15
      src/main/java/de/tims/fleetstorm/gui/GameLogic.java

15
src/main/java/de/tims/fleetstorm/gui/GameLogic.java

@ -1,6 +1,8 @@
package de.tims.fleetstorm.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
@ -8,6 +10,7 @@ import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.MatteBorder;
import de.tims.fleetstorm.ai.Logic;
@ -245,6 +248,18 @@ public class GameLogic extends JPanel {
protected void gameOver(boolean playerWinner) {
this.gameState = GameLogic.GAME_OVER;
this.removeAll();
this.setLayout(new BorderLayout());
JLabel wonLabel = new JLabel(playerWinner ? "Du hast gewonnen!" : "Du hast verloren!");
wonLabel.setHorizontalAlignment(SwingConstants.CENTER);
wonLabel.setVerticalAlignment(SwingConstants.CENTER);
wonLabel.setFont(new Font("Tahoma", Font.BOLD, 18));
this.add(wonLabel, SwingConstants.CENTER);
this.revalidate();
this.repaint();
}
public int getGameState() {

Loading…
Cancel
Save