Class FXExecutor
java.lang.Object
madkit.gui.FXExecutor
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 Summary
Modifier and TypeMethodDescriptionstatic booleanReturns whether the application is running in headless mode.static booleanReturns whether the JavaFX Platform has started.static voidrunAndWait(Runnable action) Runs the specifiedRunnableon the JavaFX application thread and waits for completion.static voidRuns the specifiedRunnableon the JavaFX application thread at some unspecified time in the future.
-
Method Details
-
runAndWait
Runs the specifiedRunnableon the JavaFX application thread and waits for completion.- Parameters:
action- theRunnableto run- Throws:
NullPointerException- ifactionisnull
-
runLater
-
isHeadlessMode
public static boolean isHeadlessMode()Returns whether the application is running in headless mode.- Returns:
trueif the application is in headless mode,falseotherwise
-
isStarted
public static boolean isStarted()Returns whether the JavaFX Platform has started.- Returns:
trueif the JavaFX Platform has started
-