JavaFX application still running after close

后端 未结 8 1157
长发绾君心
长发绾君心 2021-01-04 00:25

I\'m having problem to close my javaFX application, when I click the close button from my stage, my application disappears but if I look for it in my task manager my applica

8条回答
  •  离开以前
    2021-01-04 01:10

    The only way was to call System.exit(0);

    primaryStage.setOnCloseRequest(new EventHandler() {
                @Override
                public void handle(WindowEvent t) {
                    Platform.exit();
                    System.exit(0);
                }
            });
    

    [EDITED]

    System.exit will just hide your application, if you open SO's manager task your application will be there. The correct way is to check your Threads, one by one and close all before close application.

提交回复
热议问题