Klasse PlatformHelper

java.lang.Object
com.dua3.utility.fx.PlatformHelper

public final class PlatformHelper extends Object
The PlatformHelper class provides utility methods for performing tasks on the JavaFX application thread. It provides methods for running tasks synchronously or asynchronously on the JavaFX application thread, as well as checking if the current thread is the FX Application Thread.
  • Methodendetails

    • runAndWait

      public static void runAndWait(Runnable action)
      Run a task on the JavaFX application thread and wait for completion. Consider using runLater(Runnable) to avoid executing tasks out of order.
      Parameter:
      action - the task to run
      Löst aus:
      NullPointerException - if action is null
    • runAndWait

      public static <T extends @Nullable Object> T runAndWait(Supplier<T> action)
      Run a task on the JavaFX application thread and return result.
      Typparameter:
      T - the result type
      Parameter:
      action - the task to run
      Gibt zurück:
      the result returned by action
      Löst aus:
      NullPointerException - if action is null
    • runLater

      public static void runLater(Runnable action)
      Run a task on the JavaFX application thread.
      Parameter:
      action - the task to run
      Löst aus:
      NullPointerException - if action is null
    • checkApplicationThread

      public static void checkApplicationThread()
      Checks if the current thread is the FX Application Thread. Throws an exception if it is not.