diff --git a/Workspace/client/src/main/java/com/pqt/client/Main.java b/Workspace/client/src/main/java/com/pqt/client/Main.java index 2790ba37..05205ddc 100644 --- a/Workspace/client/src/main/java/com/pqt/client/Main.java +++ b/Workspace/client/src/main/java/com/pqt/client/Main.java @@ -2,6 +2,7 @@ package com.pqt.client; import com.pqt.client.gui.FrameManager; import javafx.application.Application; +import javafx.application.Platform; import javafx.stage.Stage; public class Main extends Application{ @@ -10,12 +11,20 @@ public class Main extends Application{ launch(args); } - @Override - public void start(Stage primaryStage) throws Exception { - FrameManager fm = new FrameManager(primaryStage); + private FrameManager fm; - primaryStage.setOnCloseRequest(event->fm.onCloseEvent()); + @Override + public void start(Stage primaryStage) { + fm = new FrameManager(primaryStage); + + primaryStage.setOnCloseRequest(event-> Platform.exit()); fm.show(); } + + @Override + public void stop(){ + if(fm!=null) + fm.onCloseEvent(); + } }