Class FXExecutor

java.lang.Object
madkit.gui.FXExecutor

public class FXExecutor extends Object
Provides a wrapper around the JavaFX Platform class with additional functionality for managing calls to the JavaFX Platform. Since MaDKit is not a JavaFX application per se, it needs to manage the JavaFX Platform lifecycle. So, the JavaFX Platform is automatically started when the environment is not in headless mode. This class provides methods to run actions on the JavaFX application thread. Especially, it provides a way to run actions on the JavaFX thread and wait for completion. This is useful when performing rendering actions in simulation.
See Also:
  • Method Details

    • runAndWait

      public static void runAndWait(Runnable action)
      Runs the specified Runnable on the JavaFX application thread and waits for completion.
      Parameters:
      action - the Runnable to run
      Throws:
      NullPointerException - if action is null
    • runLater

      public static void runLater(Runnable action)
      Runs the specified Runnable on the JavaFX application thread at some unspecified time in the future.
      Parameters:
      action - the Runnable to run
    • isHeadlessMode

      public static boolean isHeadlessMode()
      Returns whether the application is running in headless mode.
      Returns:
      true if the application is in headless mode, false otherwise
    • isStarted

      public static boolean isStarted()
      Returns whether the JavaFX Platform has started.
      Returns:
      true if the JavaFX Platform has started