diff --git a/src/main/java/Gui/ActionHandler.java b/src/main/java/Gui/ActionHandler.java new file mode 100644 index 0000000..f1adf45 --- /dev/null +++ b/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); + } + } + +} diff --git a/src/main/java/Gui/gui.java b/src/main/java/Gui/gui.java index ef552d6..599fab7 100644 --- a/src/main/java/Gui/gui.java +++ b/src/main/java/Gui/gui.java @@ -33,6 +33,8 @@ public class gui { public void createButtons() { StartBtn = new JButton("Starte Spiel"); CloseBtn = new JButton("Schlieen"); + CloseBtn.addActionListener(new ActionHandler()); + } public void createPanel() { diff --git a/target/MiniGameProject-1.0-SNAPSHOT.jar b/target/MiniGameProject-1.0-SNAPSHOT.jar index 4dd2e31..dab2b23 100644 Binary files a/target/MiniGameProject-1.0-SNAPSHOT.jar and b/target/MiniGameProject-1.0-SNAPSHOT.jar differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties index 27e88a8..8d2892b 100644 --- a/target/maven-archiver/pom.properties +++ b/target/maven-archiver/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven -#Fri Dec 30 01:08:26 CET 2022 +#Fri Dec 30 01:11:12 CET 2022 groupId=MiniGameProject artifactId=MiniGameProject version=1.0-SNAPSHOT diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 8dfad02..03f0c51 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/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\main.java