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

JFXPanel fails to render if setScene called on Swing thread

    Details

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

      Description

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

        Attachments

          Activity

            People

            • Assignee:
              psadhukhan Prasanta Sadhukhan
              Reporter:
              kcr Kevin Rushforth
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: