<Swing Dev> [11] Review Request: 8201552 Ellipsis in "Classical" label in SwingSet2 demo with Windows L&F at Hidpi

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Sat Jun 16 06:31:37 UTC 2018

Please review the fix for jdk11.

Bug: https://bugs.openjdk.java.net/browse/JDK-8201552
Webrev: http://cr.openjdk.java.net/~serb/8201552/webrev.01/

Short description:
This fix enhance implementation of JDK-8178025[1] for most of our Swing 
components. The main rule which I tried to follow:
"If layout of the component depends from the font then it should depend 
on the current graphics configuration as well, because FontMetrics 
depends on graphics configuration".

Long description:
The fix for JDK-8178025 added a special property "graphicsConfiguration" 
which: fired when the graphicsConfiguration is changed from one non-null 
value to another non-null value.
Those fix also updated some of the components(to refresh/re-validate its 
states when the "graphicsConfiguration" or "ancestor" were changed).

The usage of "ancestor" was not obvious, so I modify the code to fire 
"graphicsConfiguration" every time, this cover a situation when the 
"GC=null" is changed to "GC=non-null"(previously it was covered by 
"ancestor" property). So after this fix our components will listen only 
"font" and "graphicsConfiguration".

In implementation of JDK-8178025 the "graphicsConfiguration" is fired 
immediately after GC is changed, it caused the issues in some containers 
like JTree. When the container get such notification it usually tries to 
get some information from children, but in this moment children had 
previous graphic config, so the result calculated(and usually cached) in 
the container was wrong. In this fix I changed implementation of this 
property. Now it will fired only when the container and all its children 
are updated.

Note that the new test StalePreferredSize.java has a TODO block. Because 
JSpinner does not work properly even after the current fix. The reason 
is that during validation it is unexpectedly change the font from normal 
to bold(I'll fix this in a separate bug)

[1] https://bugs.openjdk.java.net/browse/JDK-8178025

Best regards, Sergey.

More information about the swing-dev mailing list