From def0f3a1b9ba9a4ab97593a5a1d48dd007e7833f Mon Sep 17 00:00:00 2001 From: Lorenz Hohmann Date: Fri, 14 Jan 2022 11:43:58 +0100 Subject: [PATCH] Added game info sidebar --- src/main/java/de/tims/fleetstorm/gui/GUI.java | 129 +++++++++++++++++- 1 file changed, 122 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/tims/fleetstorm/gui/GUI.java b/src/main/java/de/tims/fleetstorm/gui/GUI.java index 70d3333..10f7d8a 100644 --- a/src/main/java/de/tims/fleetstorm/gui/GUI.java +++ b/src/main/java/de/tims/fleetstorm/gui/GUI.java @@ -2,6 +2,7 @@ package de.tims.fleetstorm.gui; import java.awt.Color; import java.awt.Font; +import java.awt.GridLayout; import java.util.ArrayList; import javax.swing.JFrame; @@ -23,17 +24,131 @@ public class GUI extends JPanel { JPanel infoWrapper = new JPanel(); infoWrapper.setBounds(382, 11, 248, 458); - - JLabel hasMoveLabel = new JLabel("Am Zug:"); - hasMoveLabel.setFont(new Font("Tahoma", Font.BOLD, 11)); - infoWrapper.add(hasMoveLabel); - - JLabel hasMove = new JLabel("Spieler"); - infoWrapper.add(hasMove); + infoWrapper.setLayout(null); setLayout(null); add(fieldWrapper); add(infoWrapper); + JPanel yourFleet = new JPanel(); + yourFleet.setBounds(10, 110, 228, 93); + infoWrapper.add(yourFleet); + yourFleet.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBounds(0, 0, 228, 27); + yourFleet.add(panel_1); + panel_1.setLayout(null); + + JLabel ownFleetHeading = new JLabel("Deine Flotte:"); + ownFleetHeading.setBounds(0, 0, 228, 17); + panel_1.add(ownFleetHeading); + ownFleetHeading.setFont(new Font("Tahoma", Font.BOLD, 14)); + + JPanel panel_2 = new JPanel(); + panel_2.setBounds(0, 26, 228, 67); + yourFleet.add(panel_2); + panel_2.setLayout(new GridLayout(0, 2, 0, 3)); + + JLabel own2ShipLabel = new JLabel("1x2 Schiff"); + panel_2.add(own2ShipLabel); + + JLabel own2Ship = new JLabel("OK"); + panel_2.add(own2Ship); + + JLabel own3ShipLabel = new JLabel("1x3 Schiff"); + panel_2.add(own3ShipLabel); + + JLabel own3Ship = new JLabel("OK"); + panel_2.add(own3Ship); + + JLabel own4ShipLabel = new JLabel("1x4 Schiff"); + panel_2.add(own4ShipLabel); + + JLabel own4Ship = new JLabel("OK"); + panel_2.add(own4Ship); + + JLabel own5ShipLabel = new JLabel("1x5 Schiff"); + panel_2.add(own5ShipLabel); + + JLabel own5Ship = new JLabel("OK"); + panel_2.add(own5Ship); + + JPanel enemyFleet = new JPanel(); + enemyFleet.setLayout(null); + enemyFleet.setBounds(10, 237, 228, 93); + infoWrapper.add(enemyFleet); + + JPanel panel_1_1 = new JPanel(); + panel_1_1.setLayout(null); + panel_1_1.setBounds(0, 0, 228, 27); + enemyFleet.add(panel_1_1); + + JLabel enemyFleetHeading = new JLabel("Gegnerische Flotte:"); + enemyFleetHeading.setFont(new Font("Tahoma", Font.BOLD, 14)); + enemyFleetHeading.setBounds(0, 0, 228, 17); + panel_1_1.add(enemyFleetHeading); + + JPanel panel_2_1 = new JPanel(); + panel_2_1.setBounds(0, 26, 228, 67); + enemyFleet.add(panel_2_1); + panel_2_1.setLayout(new GridLayout(0, 2, 0, 3)); + + JLabel enemy2ShipLabel = new JLabel("1x2 Schiff"); + panel_2_1.add(enemy2ShipLabel); + + JLabel enemy2Ship = new JLabel("OK"); + panel_2_1.add(enemy2Ship); + + JLabel enemy3ShipLabel = new JLabel("1x3 Schiff"); + panel_2_1.add(enemy3ShipLabel); + + JLabel enemy3Ship = new JLabel("OK"); + panel_2_1.add(enemy3Ship); + + JLabel enemy4ShipLabel = new JLabel("1x4 Schiff"); + panel_2_1.add(enemy4ShipLabel); + + JLabel enemy4Ship = new JLabel("OK"); + panel_2_1.add(enemy4Ship); + + JLabel enemy5ShipLabel = new JLabel("1x5 Schiff"); + panel_2_1.add(enemy5ShipLabel); + + JLabel enemy5Ship = new JLabel("OK"); + panel_2_1.add(enemy5Ship); + + JPanel infos = new JPanel(); + infos.setLayout(null); + infos.setBounds(10, 11, 228, 68); + infoWrapper.add(infos); + + JPanel panel_1_2 = new JPanel(); + panel_1_2.setLayout(null); + panel_1_2.setBounds(0, 0, 228, 27); + infos.add(panel_1_2); + + JLabel gameInfoHeading = new JLabel("Spielinfos"); + gameInfoHeading.setFont(new Font("Tahoma", Font.BOLD, 14)); + gameInfoHeading.setBounds(0, 0, 228, 17); + panel_1_2.add(gameInfoHeading); + + JPanel panel_2_2 = new JPanel(); + panel_2_2.setBounds(0, 26, 228, 31); + infos.add(panel_2_2); + panel_2_2.setLayout(new GridLayout(0, 2, 0, 3)); + + JLabel matchfieldLabel = new JLabel("Spielfeld"); + panel_2_2.add(matchfieldLabel); + + JLabel matchfieldValue = new JLabel("Eigenes"); + panel_2_2.add(matchfieldValue); + + JLabel moveLabel = new JLabel("Am Zug"); + panel_2_2.add(moveLabel); + + JLabel moveValue = new JLabel("Du"); + panel_2_2.add(moveValue); + int gap = 30; int width = 28;