Reputation: 173
I want to update my javafx UI but I Don't want to use Platform.RunLater but when i want to update my Pane on :
Pane.getChildren().add(listview);
I get java.lang.illegalStateException : not on java fx application thread;current thread
Upvotes: 0
Views: 585
Reputation: 4203
You must update the UI elements on the UI thread using Platform.runLater()
.
If you have a long-running task, then perform the task first, and the update the UI with the results of the task.
Object taskResult = GetLongRunningTaskResult();
Platform.runLater(() -> Pane.getChildren().add(taskResult));
Upvotes: 1