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

JFXPanel fails to render if setScene called on Swing thread

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3
    • None
    • jfx11, jfx12, jfx13, 10
    • javafx
    • 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

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: