【问题标题】:what is equivalent of FX.defer() method in javafx 2.1javafx 2.1 中的 FX.defer() 方法的等价物是什么
【发布时间】:2012-08-22 12:32:58
【问题描述】:
 FX.deferAction(new Function0<Void>() {
       @Override public Void invoke() {
       //Some code here
         return null;
       }
    });

我将代码从 javafx 1.3 转换为 javafx 2.1,但我遇到了这个问题。 javafx 2.1中这个问题的解决方案是什么?

【问题讨论】:

    标签: javafx javafx-2


    【解决方案1】:
    javafx.application.Platform.runLater(new Runnable() {
        public void run() {
            // some code here
        }
    });
    

    【讨论】:

    • 谢谢谢尔盖。我已经使用了这段代码,但我的输出与 javafx 1.3 中的先前代码不同。因为 FX.defer() 方法在调用时运行,但 Platform.runLater() 在稍后的某个时间运行。请给我一些更好的建议。
    • 根据 JavaFX 1.3 javadoc deferAction represents an action that should be executed at a later time of the system's choosing. 如果在您的情况下“在调用时”执行,我需要更多信息。你有任何同步吗?能否提供示例代码?
    • 再次感谢谢尔盖。我的问题解决了这段代码。我错了。该方法等价于上述问题。再次感谢。
    猜你喜欢
    • 1970-01-01
    • 2016-10-22
    • 2015-10-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-05
    • 2019-08-23
    • 2020-12-02
    相关资源
    最近更新 更多