Load fxml as background process - Javafx

后端 未结 3 1239
滥情空心
滥情空心 2021-01-16 02:41

My initial fxml(say home.fxml) has a lot of functionalities, hence it takes a lot of time to load completely. So to avoid the time gap between program start and

3条回答
  •  清歌不尽
    2021-01-16 03:31

    In addition to @James_D answer. As mentioned by him, Stages and Scene should not be added in background thread, they should be added only in FX main thread.

    I have added tooltips in my home.fxml, which is nothing but a PopupWindow. Therefore to the background thread, it appeared as a new stage. Hence it threw IllegalStateException. After removing the tooltips from the fxml, the fxml was able to load as a background process as there were no stages created in that thread.

提交回复
热议问题