Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javafx, get a reference to application thread

Tags:

javafx-2

In swing we have:

boolean SwingUtilities.isEventDispatchThread()

that returns true if it is called from swing event dispatch thread.

is there anything similar in javafx?

like image 549
AgostinoX Avatar asked Mar 31 '26 08:03

AgostinoX


1 Answers

Yes you can check that you are in the FX thread with:

Platform.isFxApplicationThread();

Note that many UI interacting methods will throw an exception when called outside the FX thread.

like image 82
assylias Avatar answered Apr 03 '26 16:04

assylias