-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
jfx11, jfx12, jfx13, 10
The JFXPanel::setScene method is documented to allow calling it from either the [Swing] event dispatch thread or the JavaFX application thread. However, if you call setScene on the Swing event thread, then the scene is not shown.
To reproduce run the attached test program:
$ java SimpleJFXPanel
It should render a Swing label in the top portion of the window and a JavaFX label in the center.
The Swing label is drawn, but the JavaFX label is not.
If you modify the app to set the "SET_SCENE_ON_FX_THREAD" variable to true, which will call JFXPanel::setScene on the FX app thread, then it works as expected.
This is a regression that was introduced in JDK 10. It works in JDK 9 or earlier and fails in JDK 10, and fails in openjfx 11 or later.
Workaround: Always call setScene on the FX application thread (which is probably what most application would do anyway).
To reproduce run the attached test program:
$ java SimpleJFXPanel
It should render a Swing label in the top portion of the window and a JavaFX label in the center.
The Swing label is drawn, but the JavaFX label is not.
If you modify the app to set the "SET_SCENE_ON_FX_THREAD" variable to true, which will call JFXPanel::setScene on the FX app thread, then it works as expected.
This is a regression that was introduced in JDK 10. It works in JDK 9 or earlier and fails in JDK 10, and fails in openjfx 11 or later.
Workaround: Always call setScene on the FX application thread (which is probably what most application would do anyway).
- duplicates
-
JDK-8231372 JFXPanel fails to render if setScene called on Swing thread
- Resolved