run On Fx Thread - Java JavaFX

Java examples for JavaFX:JavaFX Thread

Description

run On Fx Thread

Demo Code


//package com.java2s;

public class Main {
    static public void runOnFxThread(final Runnable run) {
        if (javafx.application.Platform.isFxApplicationThread()) {
            run.run();/*from  ww w.j  ava2  s .  c o  m*/
        } else {
            runOnFxThreadLater(run);
        }
    }

    static public void runOnFxThreadLater(final Runnable run) {
        javafx.application.Platform.runLater(run);
    }
}

Related Tutorials