JDK-8102871 : JFXPanel renders insufficeintly on resize
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: swing
  • Affected Version: 8
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2013-06-05
  • Updated: 2015-06-16
  • Resolved: 2013-09-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8Fixed
Related Reports
Duplicate :  
Description
When JFXPanel is resized it flickers. This is caused by the fact that the scene pixels are not uploaded to the BufferedImage when size mismatch is encountered, leading to swing repaint requests being skipped.
Comments
URL: http://jfxsrc.us.oracle.com/javafx/8.0/scrum/graphics/rt/rev/4578d63378b3
17-09-2013

On Windows the problem is not (or almost not) reproducible. Also, concerning the SwingInterop demo. When I remove the swing bottom component from the split pane, I see no flickering when I resize the JFXPanel charts in either direction (Mac).
13-09-2013

update: http://cr.openjdk.java.net/~ant/RT-30932/webrev.1 The width is passed right from EmbeddedState, and this localises access to it decreasing risks of potential threading issues.
11-09-2013

webrev: http://cr.openjdk.java.net/~ant/RT-30932/webrev.0/ So, in details the problem is as follows. As the frame resizes it updates JFXPanel size and EmbeddedScene size on EDT. This is passed to EmbeddedState and then retrieved by UploadingPainter which recreates the texture based on the new size. The texture bits are then uploaded to EmbeddedScene which calls Host.repaint(). Then another resize immediately happens, JFXPanel gets new size values and copies them to the EmbeddedScene. Then, imagine, a JFXPanel.paintComponent() is called. It will request pixels to be copied to its buffer which already has been resized, but the texture bits hasn't yet. Currently, such a repaint request if ignored and here we have the flicker. The fix carefully copies bits from the fx IntBuffer to the swing IntBuffer taking into account its size mismatch. For that it stores the line stride of the fx buffer on uploading it to ES. Additionally, rttexture.unlock() is called from "finally" in UploadingPainter, in case an exception has been thrown (with what I've faced). I've tested it with the apps/ga-samples/SwingInterop demo. The "browser" tab doesn't flicker at all on any kind of resize. The "chart" tab doesn't flicker on horizontal resize, but slightly (~10 times less often than w/o the fix) flickers on vertical resize. Well, this looks odd to me, because I can't see any repaint misses. Might be another, pure FX issue?
11-09-2013

On swing side, an ImageBuffer of appropriate size could be constructed from an int array which represents a smaller image, leaving the blank space to the background. It should reduce flickering.
05-06-2013