JavaFX timer problem (Intellij & SceneBuilder) | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite

JavaFX timer problem (Intellij & SceneBuilder)

So basically, I have a project and having problem with creating the timer in JavaFX. Here's the link, it wont work in the code playground but at least you'll have better view: Every video i found, they use timer and timer task. But when i tried to display the timer using the action button "onAction", i always get this error every second: Exception in thread "Timer-0" java.lang.IllegalStateException: Not on FX application thread; currentThread = Timer-0 at at at$3.onProposedChange( at javafx.base/com.sun.javafx.collections.VetoableListDecorator.setAll( at javafx.base/com.sun.javafx.collections.VetoableListDecorator.setAll( at javafx.controls/ at javafx.controls/$new$11( at javafx.controls/com.sun.javafx.scene.control.LambdaMultiplePropertyChangeListenerHandler.lambda$new$1( at javafx.base/javafx.beans.value.WeakChangeListener.changed( at javafx.base/com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent( at javafx.base/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent( at javafx.base/

6th Jun 2021, 4:18 AM
M.O.HONOR - avatar
2 Réponses
Could you move the code to code bit and link it there, to increase readability
6th Jun 2021, 4:20 AM
Ananiya Jemberu
Ananiya Jemberu - avatar
6th Jun 2021, 8:39 AM
Denise Roßberg
Denise Roßberg - avatar