Quantcast

<Swing Dev> repaint problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

<Swing Dev> repaint problem

Alan Snyder-3
I am having a problem involving repaint with no success as yet in tracking down the cause. Perhaps someone can suggest something that would help me make some progress.

The symptom is that some portion of a repaint operation is delayed until the next repaint. In other words, I make a change to the data, which should be reflected in a change to the display, but the display is only partially updated. The next time a repaint is triggered, for example, when the window is deactivated (this is macOS), the remaining display updates appear. I have added print statements to my paint method that indicate that the paint methods are being called at the expected time. It is as if there are painting operations that are being queued, but the queue is not flushed until the next repaint.

I have noticed this problem only in a particular window of my application. I have tried stripping out various portions of the window to see if one of the components might be causing the problem, but the results are inconclusive and inconsistent. It may be that the problem is related to the number of components being updated, rather than a problem with a particular component.

I have observed this problem on JDK 8. Just now I tried running the app on JDK 9, and I have yet to observe the problem. Was a bug fixed in 9 but not backported that might explain this behavior?

My display is a HiDPI display, in case that matters.

  Alan

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: <Swing Dev> repaint problem

Sergey Bylokhov
Hi, Alan.

> I am having a problem involving repaint with no success as yet in tracking down the cause. Perhaps someone can suggest something that would help me make some progress.
>
> The symptom is that some portion of a repaint operation is delayed until the next repaint. In other words, I make a change to the data, which should be reflected in a change to the display, but the display is only partially updated. The next time a repaint is triggered, for example, when the window is deactivated (this is macOS), the remaining display updates appear. I have added print statements to my paint method that indicate that the paint methods are being called at the expected time. It is as if there are painting operations that are being queued, but the queue is not flushed until the next repaint.
>
> I have noticed this problem only in a particular window of my application. I have tried stripping out various portions of the window to see if one of the components might be causing the problem, but the results are inconclusive and inconsistent. It may be that the problem is related to the number of components being updated, rather than a problem with a particular component.
>
> I have observed this problem on JDK 8. Just now I tried running the app on JDK 9, and I have yet to observe the problem. Was a bug fixed in 9 but not backported that might explain this behavior?

Yes it is possible that some bug was fixed in jdk9 but was not backported to jdk8. I guess we have a big number of such fixes. But it is also possible that in jdk9 some timings were changed and this is why you cannot reproduce the bug on it.


Loading...