java.lang.Object
com.dua3.utility.fx.PlatformHelper
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.
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic voidChecks if the current thread is the FX Application Thread.static voidrunAndWait(Runnable action) Run a task on the JavaFX application thread and wait for completion.static <T extends @Nullable Object>
TrunAndWait(Supplier<T> action) Run a task on the JavaFX application thread and return result.static voidRun a task on the JavaFX application thread.
-
Methodendetails
-
runAndWait
Run a task on the JavaFX application thread and wait for completion. Consider usingrunLater(Runnable)to avoid executing tasks out of order.- Parameter:
action- the task to run- Löst aus:
NullPointerException- ifactionisnull
-
runAndWait
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- ifactionisnull
-
runLater
Run a task on the JavaFX application thread.- Parameter:
action- the task to run- Löst aus:
NullPointerException- ifactionisnull
-
checkApplicationThread
public static void checkApplicationThread()Checks if the current thread is the FX Application Thread. Throws an exception if it is not.
-