When creating Node trees from a separate thread (before adding them to the scene from the JavaFX thread), I have run in to the exception below, coming from TextFieldBehavior which seems to create a ContextMenu which - for reasons I do not know - requires the JavaFX thread.
I need to create 100 node trees, so not being able to run the creation on multiple threads makes system performance suffer severely. This is critical to us, so I hope you do not mind me marking this issue as important.
Nov 22, 2012 9:47:32 PM com.intuism.ui.component.showcase.Showcase$8$1 call
INFO: Exception
java.lang.IllegalStateException: Not on FX application thread; currentThread = Thread-18
at com.sun.javafx.tk.Toolkit.checkFxUserThread(Toolkit.java:237)
at com.sun.javafx.tk.quantum.QuantumToolkit.checkFxUserThread(QuantumToolkit.java:397)
at javafx.scene.Scene.<init>(Scene.java:287)
at javafx.scene.Scene.<init>(Scene.java:195)
at javafx.stage.PopupWindow.<init>(PopupWindow.java:109)
at javafx.scene.control.PopupControl.<init>(PopupControl.java:99)
at javafx.scene.control.ContextMenu.<init>(ContextMenu.java:129)
at com.sun.javafx.scene.control.behavior.TextFieldBehavior.<init>(TextFieldBehavior.java:104)
at com.sun.javafx.scene.control.skin.TextFieldSkin.<init>(TextFieldSkin.java:152)
at com.intuism.ui.form.text.ITextFieldSkin.<init>(ITextFieldSkin.java:17)
at com.intuism.ui.form.text.ITextField.<init>(ITextField.java:59)
at com.intuism.ui.form.text.ITextField.<init>(ITextField.java:52)
at com.intuism.ui.form.text.ITextField.<init>(ITextField.java:49)
at com.wefend.pc.timeline.views.LoginEventView.<init>(LoginEventView.java:59)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at com.intuism.ui.component.showcase.TypeMappingViewFactory.createView(TypeMappingViewFactory.java:38)
at com.intuism.ui.component.showcase.Slot.createView(Slot.java:42)
at com.intuism.ui.component.showcase.Slot.<init>(Slot.java:35)
at com.intuism.ui.component.showcase.Showcase$8$1.call(Showcase.java:253)
at javafx.concurrent.Task$TaskCallable.call(Task.java:1259)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.lang.Thread.run(Thread.java:722)
I need to create 100 node trees, so not being able to run the creation on multiple threads makes system performance suffer severely. This is critical to us, so I hope you do not mind me marking this issue as important.
Nov 22, 2012 9:47:32 PM com.intuism.ui.component.showcase.Showcase$8$1 call
INFO: Exception
java.lang.IllegalStateException: Not on FX application thread; currentThread = Thread-18
at com.sun.javafx.tk.Toolkit.checkFxUserThread(Toolkit.java:237)
at com.sun.javafx.tk.quantum.QuantumToolkit.checkFxUserThread(QuantumToolkit.java:397)
at javafx.scene.Scene.<init>(Scene.java:287)
at javafx.scene.Scene.<init>(Scene.java:195)
at javafx.stage.PopupWindow.<init>(PopupWindow.java:109)
at javafx.scene.control.PopupControl.<init>(PopupControl.java:99)
at javafx.scene.control.ContextMenu.<init>(ContextMenu.java:129)
at com.sun.javafx.scene.control.behavior.TextFieldBehavior.<init>(TextFieldBehavior.java:104)
at com.sun.javafx.scene.control.skin.TextFieldSkin.<init>(TextFieldSkin.java:152)
at com.intuism.ui.form.text.ITextFieldSkin.<init>(ITextFieldSkin.java:17)
at com.intuism.ui.form.text.ITextField.<init>(ITextField.java:59)
at com.intuism.ui.form.text.ITextField.<init>(ITextField.java:52)
at com.intuism.ui.form.text.ITextField.<init>(ITextField.java:49)
at com.wefend.pc.timeline.views.LoginEventView.<init>(LoginEventView.java:59)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at com.intuism.ui.component.showcase.TypeMappingViewFactory.createView(TypeMappingViewFactory.java:38)
at com.intuism.ui.component.showcase.Slot.createView(Slot.java:42)
at com.intuism.ui.component.showcase.Slot.<init>(Slot.java:35)
at com.intuism.ui.component.showcase.Showcase$8$1.call(Showcase.java:253)
at javafx.concurrent.Task$TaskCallable.call(Task.java:1259)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.lang.Thread.run(Thread.java:722)
- duplicates
-
JDK-8093856 Some controls can only be created on the FX application thread
- Resolved