Java examples for JavaFX:JavaFX Thread
run On JavaFX Thread
//package com.java2s; import javafx.application.Platform; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.DoubleConsumer; import java.util.function.LongConsumer; public class Main { public static void runOnJFXThread(final Runnable runnable) { Platform.runLater(runnable); }/*w w w . j av a 2 s . c om*/ public static <T> void runOnJFXThread(final Consumer<T> consumer, final T t) { Platform.runLater(() -> consumer.accept(t)); } public static void runOnJFXThread(final LongConsumer consumer, final long l) { Platform.runLater(() -> consumer.accept(l)); } public static void runOnJFXThread(final DoubleConsumer consumer, final double d) { Platform.runLater(() -> consumer.accept(d)); } public static <T, U> void runOnJFXThread(final BiConsumer<T, U> consumer, final T t, final U u) { Platform.runLater(() -> consumer.accept(t, u)); } }