From dbcd44f2125e86d43451f51af8ec1a009eef7711 Mon Sep 17 00:00:00 2001 From: Muhammad Fahim Tajwar Date: Mon, 20 Feb 2023 16:20:47 +0800 Subject: [PATCH] Add save functionality when window is closed by [X] button. --- src/main/java/chad/frontend/Main.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/chad/frontend/Main.java b/src/main/java/chad/frontend/Main.java index 0318a92c27..d699e0d892 100644 --- a/src/main/java/chad/frontend/Main.java +++ b/src/main/java/chad/frontend/Main.java @@ -131,7 +131,7 @@ */ public class Main extends Application { - private Chad chad; + private static Chad chad; public static void exit() { Platform.exit(); @@ -154,6 +154,12 @@ public void start(Stage stage) { } } + @Override + public void stop() throws Exception { + chad.getResponse("bye"); + super.stop(); + } + public static void main(String[] args) { Application.launch(Main.class, args); }