Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8235843

JFXPanel fails to render if setScene called on Swing thread


    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 10, openjfx11, openjfx12, openjfx13
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:
    • Subcomponent:
    • Introduced In Version:


      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).


          Issue Links



              • Assignee:
                kcr Kevin Rushforth
                kcr Kevin Rushforth
              • Votes:
                0 Vote for this issue
                2 Start watching this issue


                • Created: