diff --git a/GameProject/src/base/GameLoop.java b/GameProject/src/base/GameLoop.java
index f98bd42..d3cbd44 100644
--- a/GameProject/src/base/GameLoop.java
+++ b/GameProject/src/base/GameLoop.java
@@ -10,6 +10,7 @@ import gameobjects.GameObject;
import playground.Level1;
import playground.Playground;
import ui.GameUI;
+import ui.GameUIWithLogin;
/**
@@ -86,7 +87,7 @@ public class GameLoop {
public void runGame(String[] args) throws IOException {
logger.info("GUI starts");
- GameUI gameUI = new GameUI(SIZEX, SIZEY); // probably change to your new GUI class
+ GameUI gameUI = new GameUIWithLogin(SIZEX, SIZEY); // probably change to your new GUI class
double gameTime = -1;
Playground currentPlayground = null;
diff --git a/GameProject/src/log4j2.xml b/GameProject/src/log4j2.xml
index 9db2129..ac06ded 100644
--- a/GameProject/src/log4j2.xml
+++ b/GameProject/src/log4j2.xml
@@ -20,7 +20,7 @@
-
+
diff --git a/GameProject/src/ui/GameUIWithLogin.java b/GameProject/src/ui/GameUIWithLogin.java
new file mode 100644
index 0000000..7a15de4
--- /dev/null
+++ b/GameProject/src/ui/GameUIWithLogin.java
@@ -0,0 +1,39 @@
+package ui;
+
+import java.awt.event.ActionEvent;
+import java.util.*;
+
+import javax.swing.JMenuItem;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+
+public class GameUIWithLogin extends GameUI {
+
+ private static final Logger logger = LogManager.getLogger(GameUIWithLogin.class);
+
+ protected JMenuItem loginItem;
+
+ public GameUIWithLogin(int sizeX, int sizeY) {
+ super(sizeX, sizeY);
+ logger.info("Hello Test");
+ this.loginItem = new JMenuItem("Login ...");
+ this.gameMenu.add(loginItem, 0);
+ this.loginItem.addActionListener(this);
+
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent ae) {
+ super.actionPerformed(ae);
+
+ if (ae.getSource() == this.loginItem) {
+ LoginWindow window = new LoginWindow(250, 300);
+ window.show();
+ }
+
+ }
+
+}
+
diff --git a/GameProject/src/ui/LoginWindow.java b/GameProject/src/ui/LoginWindow.java
new file mode 100644
index 0000000..94c8280
--- /dev/null
+++ b/GameProject/src/ui/LoginWindow.java
@@ -0,0 +1,63 @@
+package ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.*;
+
+public class LoginWindow implements ActionListener{
+ protected JFrame frame;
+ protected JPanel panel;
+
+
+ protected JLabel loginLabel;
+ protected JTextField loginText;
+ protected JLabel passwordlabel;
+ protected JTextField passwordText;
+ protected JButton loginButton;
+ protected JOptionPane loginSuccess;
+ protected JOptionPane loginFailed;
+
+
+
+ public LoginWindow(int sizeX, int sizeY) {
+ this.frame = new JFrame("Login");
+ this.frame.setSize(sizeX, sizeY);
+ this.panel = new JPanel();
+ this.frame.add(panel);
+ this.panel.setLayout(new BoxLayout(this.panel, BoxLayout.Y_AXIS));
+ this.loginLabel = new JLabel("Login:");
+ this.loginText = new JTextField();
+ this.passwordlabel = new JLabel("Password:");
+ this.passwordText = new JTextField();
+ this.loginButton = new JButton("Login");
+ this.loginButton.addActionListener(this);
+
+
+ this.panel.add(loginLabel);
+ this.panel.add(loginText);
+ this.panel.add(passwordlabel);
+ this.panel.add(passwordText);
+ this.panel.add(loginButton);
+ }
+
+ public void actionPerformed (ActionEvent ae) {
+
+ if(ae.getSource() == this.loginButton) {
+ if (loginText.getText().equals("admin") && passwordText.getText().equals("Password123!")) {
+ JOptionPane.showMessageDialog(frame, "Login erfolgreich", "Login Meldung", JOptionPane.INFORMATION_MESSAGE);
+ frame.setVisible(false);
+
+ } else {
+ JOptionPane.showMessageDialog(frame, "Login fehlgeschlagen", "Login Meldung", JOptionPane.ERROR_MESSAGE);
+
+ }
+ }
+ }
+
+ public void show() {
+ frame.setVisible(true);
+
+ }
+
+}