<AWT Dev> Request for Review: 7170655 frame size change does not follow label font change

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue May 22 12:42:06 PDT 2012

Hi, Jonathan,
It`s strange to me that the component size depends on the sequence of 
paint events and I`ve looked deeper. And I`ve found that the main 
problem is that XLabelPeer updates its caches (cachedFontMetrics and 
oldfont) in the paintPeer(). So when we postpone the paint, 
frame.pack()->...->getMinimumSize() uses old caches and when we paint in 
a place, getMinimumSize() uses correct values.

22.05.2012 18:23, Sergey Bylokhov wrote:
> Hi, Jonathan,
> Looks like this bug is duplicate of 
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7161865
> And the reason of the issue is that we post UpdateEvent in 
> target.repaint() in XLabelPeer.setFont(), but we should paint native 
> part of the component in place[1] and then post PaintEvent[2].
>  - To fix [1] we can replace target.repaint() to repaint() in 
> setFont(). Does it solve your issue?
> 22.05.2012 11:47, Jonathan Lu wrote:
>> Hi awt-dev,
>> Here's a patch for bug 7170655, could anybody please help to take a 
>> look?
>> http://cr.openjdk.java.net/~luchsh/7170655/
>> The problem is that painting event from EDT during painting handling 
>> does not get processed immediately, so leave a lag to the user. My 
>> solution here is to coalesce and dispatch the new paint event right 
>> after it was posted. This happens only to AWT components.
>> Thanks!
>> -Jonathan

Best regards, Sergey.

More information about the awt-dev mailing list