Browse Source

Added Close functionality to CloseBtn

master
Leon Montag 2 years ago
parent
commit
f509cbb516
  1. 15
      src/main/java/Gui/ActionHandler.java
  2. 2
      src/main/java/Gui/gui.java
  3. BIN
      target/MiniGameProject-1.0-SNAPSHOT.jar
  4. 2
      target/maven-archiver/pom.properties
  5. 1
      target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

15
src/main/java/Gui/ActionHandler.java

@ -0,0 +1,15 @@
package Gui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ActionHandler implements ActionListener {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == gui.CloseBtn) {
System.exit(0);
}
}
}

2
src/main/java/Gui/gui.java

@ -33,6 +33,8 @@ public class gui {
public void createButtons() { public void createButtons() {
StartBtn = new JButton("Starte Spiel"); StartBtn = new JButton("Starte Spiel");
CloseBtn = new JButton("Schlieen"); CloseBtn = new JButton("Schlieen");
CloseBtn.addActionListener(new ActionHandler());
} }
public void createPanel() { public void createPanel() {

BIN
target/MiniGameProject-1.0-SNAPSHOT.jar

2
target/maven-archiver/pom.properties

@ -1,5 +1,5 @@
#Generated by Maven #Generated by Maven
#Fri Dec 30 01:08:26 CET 2022
#Fri Dec 30 01:11:12 CET 2022
groupId=MiniGameProject groupId=MiniGameProject
artifactId=MiniGameProject artifactId=MiniGameProject
version=1.0-SNAPSHOT version=1.0-SNAPSHOT

1
target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@ -1,2 +1,3 @@
C:\Users\Leon\MiniGameProject\src\main\java\Gui\ActionHandler.java
C:\Users\Leon\MiniGameProject\src\main\java\Gui\gui.java C:\Users\Leon\MiniGameProject\src\main\java\Gui\gui.java
C:\Users\Leon\MiniGameProject\src\main\java\main.java C:\Users\Leon\MiniGameProject\src\main\java\main.java
Loading…
Cancel
Save