Browse Source

ha 10 fertig (kommentare entfernt)

master
fdai7222 2 years ago
parent
commit
d4bf141426
  1. 1
      spaceinvaders/GameProject/bin/.gitignore
  2. BIN
      spaceinvaders/GameProject/bin/ui/GameUI.class
  3. BIN
      spaceinvaders/GameProject/bin/ui/GameUIWithLogin.class
  4. BIN
      spaceinvaders/GameProject/bin/ui/LoginWindow.class
  5. 9
      spaceinvaders/GameProject/log/log4j.log
  6. 5
      spaceinvaders/GameProject/src/ui/GameUI.java
  7. 12
      spaceinvaders/GameProject/src/ui/GameUIWithLogin.java
  8. 4
      spaceinvaders/GameProject/src/ui/LoginWindow.java

1
spaceinvaders/GameProject/bin/.gitignore

@ -0,0 +1 @@
/ui/

BIN
spaceinvaders/GameProject/bin/ui/GameUI.class

BIN
spaceinvaders/GameProject/bin/ui/GameUIWithLogin.class

BIN
spaceinvaders/GameProject/bin/ui/LoginWindow.class

9
spaceinvaders/GameProject/log/log4j.log

@ -5559,3 +5559,12 @@
2022-06-30 15:04:29,495 INFO base.GameLoop - GUI starts 2022-06-30 15:04:29,495 INFO base.GameLoop - GUI starts
2022-06-30 16:48:22,817 INFO base.GameLoop - GUI starts 2022-06-30 16:48:22,817 INFO base.GameLoop - GUI starts
2022-06-30 16:49:00,156 INFO base.GameLoop - GUI starts 2022-06-30 16:49:00,156 INFO base.GameLoop - GUI starts
2022-07-01 10:58:42,860 INFO base.GameLoop - GUI starts
2022-07-01 11:00:50,737 INFO base.GameLoop - GUI starts
2022-07-01 11:07:20,302 INFO base.GameLoop - GUI starts
2022-07-01 11:08:49,325 INFO base.GameLoop - GUI starts
2022-07-01 11:13:36,261 INFO base.GameLoop - GUI starts
2022-07-01 11:13:58,459 INFO base.GameLoop - GUI starts
2022-07-01 11:16:20,950 INFO base.GameLoop - GUI starts
2022-07-01 11:17:51,360 INFO base.GameLoop - GUI starts
2022-07-01 18:39:59,465 INFO base.GameLoop - GUI starts

5
spaceinvaders/GameProject/src/ui/GameUI.java

@ -47,7 +47,6 @@ public class GameUI implements ActionListener {
protected JMenuItem saveItem; protected JMenuItem saveItem;
protected JMenuItem quitItem; protected JMenuItem quitItem;
protected JMenuItem aboutItem; protected JMenuItem aboutItem;
//protected JMenuItem loginItem;
protected JMenu gameMenu; protected JMenu gameMenu;
protected JMenu helpMenu; protected JMenu helpMenu;
@ -108,7 +107,7 @@ public class GameUI implements ActionListener {
this.loadItem = new JMenuItem("Restore game"); this.loadItem = new JMenuItem("Restore game");
this.saveItem = new JMenuItem("Save game"); this.saveItem = new JMenuItem("Save game");
this.quitItem = new JMenuItem("Exit game"); this.quitItem = new JMenuItem("Exit game");
//this.loginItem = new JMenuItem("Login... P E N I S");
this.playItem.addActionListener(this); this.playItem.addActionListener(this);
this.loadItem.addActionListener(this); this.loadItem.addActionListener(this);
@ -116,7 +115,7 @@ public class GameUI implements ActionListener {
this.quitItem.addActionListener(this); this.quitItem.addActionListener(this);
this.gameMenu = new JMenu("Game"); this.gameMenu = new JMenu("Game");
//this.gameMenu.add(loginItem);
this.gameMenu.add(playItem); this.gameMenu.add(playItem);
this.gameMenu.add(loadItem); this.gameMenu.add(loadItem);
this.gameMenu.add(saveItem); this.gameMenu.add(saveItem);

12
spaceinvaders/GameProject/src/ui/GameUIWithLogin.java

@ -1,6 +1,5 @@
package ui; package ui;
//einfach erstmal alle Imports der Elternklassse mitgenommen...
import java.util.*; import java.util.*;
import javax.swing.*; import javax.swing.*;
import playground.Playground; import playground.Playground;
@ -19,9 +18,9 @@ public class GameUIWithLogin extends GameUI {
public GameUIWithLogin(int sizeX, int sizeY) { public GameUIWithLogin(int sizeX, int sizeY) {
super(sizeX, sizeY); super(sizeX, sizeY);
this.loginItem = new JMenuItem("Login..."); // legt den button an (mit String name)
this.loginItem.addActionListener(this); //added den listener
this.gameMenu.add(loginItem); // added den Button zum Menue
this.loginItem = new JMenuItem("Login...");
this.loginItem.addActionListener(this);
this.gameMenu.add(loginItem, 0);
} }
@ -29,11 +28,8 @@ public class GameUIWithLogin extends GameUI {
public void actionPerformed(ActionEvent ae) { public void actionPerformed(ActionEvent ae) {
super.actionPerformed(ae); super.actionPerformed(ae);
if(ae.getSource() == this.loginItem) { if(ae.getSource() == this.loginItem) {
System.out.println();
System.out.println("test");
LoginWindow login = new LoginWindow(0,0); LoginWindow login = new LoginWindow(0,0);
//JFrame login = new JFrame();
//login.setVisible(true);
} }

4
spaceinvaders/GameProject/src/ui/LoginWindow.java

@ -42,7 +42,7 @@ public class LoginWindow extends GameUIWithLogin implements ActionListener {
this.tf2.addActionListener(this); this.tf2.addActionListener(this);
this.login.addActionListener(this); this.login.addActionListener(this);
this.frame.setSize(200, 200);
this.frame.setSize(250, 200);
this.frame.setVisible(true); this.frame.setVisible(true);
@ -64,4 +64,4 @@ public class LoginWindow extends GameUIWithLogin implements ActionListener {
}
}
Loading…
Cancel
Save