From face475c2fa54f76d14bc053e21a28401d06906c Mon Sep 17 00:00:00 2001 From: Ozan-Can Ekinci Date: Wed, 11 Jan 2023 22:49:11 +0100 Subject: [PATCH] implemented closing button functionality --- src/main/java/Gui/ActionHandler.java | 5 +++++ src/main/java/Gui/GameGui.java | 1 + 2 files changed, 6 insertions(+) diff --git a/src/main/java/Gui/ActionHandler.java b/src/main/java/Gui/ActionHandler.java index c435468..070d9e3 100644 --- a/src/main/java/Gui/ActionHandler.java +++ b/src/main/java/Gui/ActionHandler.java @@ -9,6 +9,11 @@ public class ActionHandler implements ActionListener { if (e.getSource() == gui.CloseBtn) { System.exit(0); } + + if (e.getSource() == GameGui.ClosingBtn) { + System.exit(0); + } + } } diff --git a/src/main/java/Gui/GameGui.java b/src/main/java/Gui/GameGui.java index 9943c8d..065dfe9 100644 --- a/src/main/java/Gui/GameGui.java +++ b/src/main/java/Gui/GameGui.java @@ -144,5 +144,6 @@ GridBagConstraints gbc; LosingPanel.add(ClosingBtn,gbc); RestartBtn.addActionListener(new RestartGame()); + ClosingBtn.addActionListener(new ActionHandler()); } }