Update JavaFX Live nodes outside Application Thread

You are confusing what is not allowed with what throws exceptions. Just because something doesn’t throw an exception doesn’t mean it is allowed, or that it is safe, or that it is guaranteed to work.

All changes to nodes that are part of a live scene graph must happen on the JavaFX Application Thread.

JavaFX makes a best effort to throw exceptions if this rule is violated. Checking the thread costs time, and for some operations the performance cost of checking the thread is too high, so not all violations of the rule will result in an exception. However, violating the rule is prone to inconsistent behavior at arbitrary times in the future, even if no exception is thrown. See Moving circle randomly disappears (javafx) for an example of this happening in practice.

Leave a Comment