-
Bug
-
Resolution: Fixed
-
P4
-
7u15
-
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);
}
});
}
}
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);
}
});
}
}