how to stop “JavaFX Application Thread”

后端 未结 4 1676
暖寄归人
暖寄归人 2020-12-15 06:31

I have a simple console application which sometimes need to perform graphics operations, for those I\'m using JavaFx framework (there are some functions that I need like the

4条回答
  •  醉梦人生
    2020-12-15 07:21

    Your main function does not belong to the JavaFx Application object and i think that your program never eneter application thread loop.

    It seems you should do:

    public class SOTestFX extends Application {
        public static void main(String[] args) {
            launch(args);
        }
        @Override
        public void start(Stage stage) throws Exception {
            // Do stuff here to show your stage or whatever you want;
            // This will be called on the JavaFX thread
        }
    }
    

提交回复
热议问题