From daf48307f4fbba96e2e658547e776af24c2b532c Mon Sep 17 00:00:00 2001 From: ekresse Date: Mon, 30 Nov 2020 16:46:59 +0100 Subject: [PATCH] GUI Updates --- src/de/jaujau/daten/Spielerverwaltung.java | 6 +- src/de/jaujau/gui/Menue_GUI.java | 123 +++++++++++++++++++++ src/de/jaujau/gui/Menü_GUI.java | 34 ------ 3 files changed, 126 insertions(+), 37 deletions(-) create mode 100644 src/de/jaujau/gui/Menue_GUI.java delete mode 100644 src/de/jaujau/gui/Menü_GUI.java diff --git a/src/de/jaujau/daten/Spielerverwaltung.java b/src/de/jaujau/daten/Spielerverwaltung.java index 8c7a4d8..b73d583 100644 --- a/src/de/jaujau/daten/Spielerverwaltung.java +++ b/src/de/jaujau/daten/Spielerverwaltung.java @@ -12,7 +12,7 @@ public class Spielerverwaltung { // Fields // - private unsigned int level; + private int level; /** * arraylist von Spieler */ @@ -36,7 +36,7 @@ public class Spielerverwaltung { * Set the value of level * @param newVar the new value of level */ - public void setLevel (unsigned int newVar) { + public void setLevel (int newVar) { level = newVar; } @@ -44,7 +44,7 @@ public class Spielerverwaltung { * Get the value of level * @return the value of level */ - public unsigned int getLevel () { + public int getLevel () { return level; } diff --git a/src/de/jaujau/gui/Menue_GUI.java b/src/de/jaujau/gui/Menue_GUI.java new file mode 100644 index 0000000..a2d8dec --- /dev/null +++ b/src/de/jaujau/gui/Menue_GUI.java @@ -0,0 +1,123 @@ +package de.jaujau.gui; + +import java.awt.EventQueue; +import java.awt.Image; + +import javax.swing.JFrame; +import javax.swing.JButton; +import java.awt.BorderLayout; +import javax.swing.JPanel; +import javax.imageio.ImageIO; +import javax.swing.BoxLayout; +import javax.swing.Icon; + +import java.awt.Color; +import java.awt.Dimension; +import javax.swing.JLabel; +import javax.swing.ImageIcon; +import javax.swing.SwingConstants; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.awt.Component; +import java.awt.Font; + +public class Menue_GUI { + + private JFrame frame; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + Menue_GUI window = new Menue_GUI(); + window.frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the application. + */ + public Menue_GUI() { + initialize(); + } + + /** + * Initialize the contents of the frame. + */ + + + //Test GUI für JauJau + + + private void initialize() { + frame = new JFrame(); + frame.setBounds(100, 100, 783, 762); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.getContentPane().setLayout(new BorderLayout(0, 0)); + + JPanel panel_top = new JPanel(); + panel_top.setPreferredSize(new Dimension(200, 100)); + panel_top.setBackground(new Color(0, 0, 128)); + frame.getContentPane().add(panel_top, BorderLayout.NORTH); + panel_top.setLayout(new BorderLayout(0, 0)); + + JLabel lblNewLabel_1 = new JLabel("JauJau"); + lblNewLabel_1.setForeground(Color.WHITE); + lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER); + lblNewLabel_1.setInheritsPopupMenu(false); + lblNewLabel_1.setIgnoreRepaint(false); + lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 40)); + lblNewLabel_1.setVerticalAlignment(SwingConstants.CENTER); + panel_top.add(lblNewLabel_1, BorderLayout.CENTER); + + JPanel panel_side = new JPanel(); + panel_side.setBackground(new Color(100, 149, 237)); + panel_side.setPreferredSize(new Dimension(200, 400)); + frame.getContentPane().add(panel_side, BorderLayout.WEST); + panel_side.setLayout(new BorderLayout(0, 0)); + + JPanel panel_buttons = new JPanel(); + panel_buttons.setBackground(new Color(0, 0, 128)); + panel_buttons.setPreferredSize(new Dimension(50, 200)); + panel_side.add(panel_buttons, BorderLayout.WEST); + panel_buttons.setLayout(new BorderLayout(0, 0)); + + JPanel panel = new JPanel(); + panel.setBackground(new Color(0, 0, 153)); + panel.setPreferredSize(new Dimension(50, 50)); + panel_buttons.add(panel, BorderLayout.NORTH); + panel.setLayout(new BorderLayout(0, 0)); + + + JLabel lblNewLabel = new JLabel(""); + lblNewLabel.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + panel_side.setVisible(false); + } + }); + lblNewLabel.setPreferredSize(new Dimension(50, 50)); + lblNewLabel.setAlignmentX(Component.CENTER_ALIGNMENT); + lblNewLabel.setHorizontalTextPosition(SwingConstants.CENTER); + lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); + ImageIcon imageIcon = new ImageIcon(new ImageIcon("C:\\Users\\Elmar\\Pictures\\exit.png").getImage().getScaledInstance(40, 40, Image.SCALE_DEFAULT)); + lblNewLabel.setIcon(imageIcon); + panel.add(lblNewLabel, BorderLayout.CENTER); + + JPanel panel_main = new JPanel(); + panel_main.setPreferredSize(new Dimension(600, 600)); + frame.getContentPane().add(panel_main, BorderLayout.CENTER); + } + +} diff --git a/src/de/jaujau/gui/Menü_GUI.java b/src/de/jaujau/gui/Menü_GUI.java deleted file mode 100644 index 5cd164b..0000000 --- a/src/de/jaujau/gui/Menü_GUI.java +++ /dev/null @@ -1,34 +0,0 @@ -package de.jaujau.gui; - -import java.util.*; - - -/** - * Class Menü_GUI - */ -public class Menü_GUI { - - // - // Fields - // - - - // - // Constructors - // - public Menü_GUI () { }; - - // - // Methods - // - - - // - // Accessor methods - // - - // - // Other methods - // - -}