提交后台作业并更新结果阶段 [英] Submitting a background job and updating stage with result

查看:60
本文介绍了提交后台作业并更新结果阶段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用JavaFX 2的完全菜鸟-(今天早上从我正在适应的HelloWorld开始).

I'm a complete noob with JavaFX 2 - (started this morning with a HelloWorld that I'm adapting).

我需要使用后台线程的结果来更新Text节点. JavaFX2有什么需要我特别注意的地方吗?或者提交一个可调用对象并更新文本就足够了.指向教程的指针将不胜感激.

I need to update a Text node with the result of a background thread. Is there anything special I need to be aware of with JavaFX2 or is it simply enough to submit a callable and update the text. A pointer to a tutorial would be appreciated.

推荐答案

计算结果后,运行

      Platform.runLater(new Runnable() {
            @Override
            public void run() {
                // Update the text node with calculated results
            }
       });

在正常情况下,在同一后台线程末尾的

就足够了.此链接可能也有帮助:
在JavaFX中后台执行任务.

at the end of the same background thread is enough in normal situations. This link also maybe helpful:
Execute task in background in JavaFX.

这篇关于提交后台作业并更新结果阶段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆