javafx应用程序线程异常Exception in thread "JavaFx Application Thread"

前几天用javafx做小桌面应用程序出现了一个问题:

 

 

反复检查,最终确定报错的原因是UI刷新频率过快导致的

javafx提供了Platform.runLater用于解决该问题:

Platform.runLater(new Runnable()
{
    @Override
    public void run()
    {
        //用Platform.runLater来运行需要高频调用的方法
        documentTextArea.setText(documentString);
    }
});

总结:需要高频调用方法使用Platform.runLater

posted @ 2020-04-28 17:11  qinggua  阅读(6870)  评论(0编辑  收藏  举报