How JavaFX application thread works?

There is a Java FX event dispatch thread, which handle all GUI-related tasks. You must update all UI components in this thread.
Long-running tasks, like Thread.sleep should never be executed in this thread, since windows will hang, and the GUI will be frozen.

Execute all your code in the application main thread, and perform only GUI tasks in JavaFX thread, by calling Platform.runLater.

References on this topic:

Leave a Comment