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

Java Swing application hangs when embedding a video scene.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 7u15
    • javafx
    • Windows 7 Profressional, Service Pack 1

      java version "1.7.0_17"
      Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
      Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

      After embedding a video inside a standalone Java Swing application with JavaFX media. I found that three different threads (AWT-Queue, JavaFX application thread and QuantumRenderer) are being calling the repaint routine on the JFXPanel causing the application to hang. I have solved this problem by validating when the repaint method is called from AWT and QuantumRenderer, and queuing it into the JavaFX thread.

      Here is the snipped:

          @Override
          public void repaint(final long tm,
                  final int x,
                  final int y,
                  final int width,
                  final int height) {
              log.log(Level.INFO,"repaint(long, int, int, int, int)");
              if(Platform.isFxApplicationThread()) {
                  super.repaint(tm, x, y, width, height);
              } else {
                  Platform.runLater(new Runnable() {
                      
                      @Override
                      public void run() {
                          JFXVideoPanel.super.repaint(tm, x, y, width, height);
                      }
                  });
              }
          }

            ant Anton Tarasov (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: