From afd9aa24789abe824463d25336f4e50e31f6fbef Mon Sep 17 00:00:00 2001 From: Leon Montag Date: Fri, 30 Dec 2022 01:25:07 +0100 Subject: [PATCH] add ActionListener to Start Button --- src/main/java/Gui/StartGameGui.java | 15 +++++++++++++++ src/main/java/Gui/gui.java | 1 + 2 files changed, 16 insertions(+) create mode 100644 src/main/java/Gui/StartGameGui.java diff --git a/src/main/java/Gui/StartGameGui.java b/src/main/java/Gui/StartGameGui.java new file mode 100644 index 0000000..65a9019 --- /dev/null +++ b/src/main/java/Gui/StartGameGui.java @@ -0,0 +1,15 @@ +package Gui; + +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + + +public class StartGameGui implements ActionListener { + + @Override + public void actionPerformed(ActionEvent e) { + gui.Panel.setVisible(false); + } + +} diff --git a/src/main/java/Gui/gui.java b/src/main/java/Gui/gui.java index 599fab7..e92cfc4 100644 --- a/src/main/java/Gui/gui.java +++ b/src/main/java/Gui/gui.java @@ -32,6 +32,7 @@ public class gui { public void createButtons() { StartBtn = new JButton("Starte Spiel"); + StartBtn.addActionListener(new StartGameGui()); CloseBtn = new JButton("Schlieen"); CloseBtn.addActionListener(new ActionHandler());