quartaela
quartaela

Reputation: 2757

Do i need to call Platform.runLater for updating UI if i'm working on JavaFX Application Thread

Do i need to create a new Runnable object and run Platform.runLater if i'm still working on JavaFX Application Thread for updating UI. For example, i need to update a Text object which is imported in Controller Class from a fxml file, and i will call a static method from another class to do this. Moreover, the imported Text object is static, so is it safe to call static object like;

ControllerClass.textLabel.setText("foobar");

or even if i'm working on JavaFX Application Thread, should using Platform.runLater will be more safe for updating UI ?

Upvotes: 0

Views: 420

Answers (1)

jewelsea
jewelsea

Reputation: 159416

No.

You do not need to use Platform.runLater if you are already in the JavaFX application thread.

Upvotes: 2

Related Questions