RFR: 8289539: The color returned by CheckBox.interiorBackground is incorrect
Jayathirth D V
jdv at openjdk.org
Tue Sep 27 07:30:21 UTC 2022
On Thu, 22 Sep 2022 06:59:59 GMT, Tejesh R <tr at openjdk.org> wrote:
> The color returned for `InteriorBackground` property is the default color used for only _WindowsClassicLookAndFeel_. For _WindowsLookAndFeel_ the `InteriorBackground` color is not been used when checkbox paint happens. In _WindowsLookAndFeel_ the CheckBox check/uncheck is drawn using `ImageCache` which is totally independent of `InteriorBackground` color in which the user expects it to be.
> The proposed fix is to return null for _WindowsLookAndFeel_ (which is what happens in other LookAndFeel like Metal/Synth/Motif/Aqua ) and return default color which is the actual color used in _WindowsClassicLookAndFeel_.
We use GetSysColor(https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getsyscolor) to set different values for desktop properties at https://github.com/openjdk/jdk/blob/master/src/java.desktop/windows/native/libawt/windows/awt_DesktopProperties.cpp#L511
We store these values(or some default value if desktop property is null) as shown at : https://github.com/openjdk/jdk/blob/master/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java#L508
And then map them to individual UI components like checkbox: https://github.com/openjdk/jdk/blob/master/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java#L660
>From https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getsyscolor we can see that some parameters are not supported in particular windows platforms.
I think we should find out whether there is any way to get proper interior background color or need to map to different Desktop color property in some platforms. If there is no way to get appropriate interior background color then we may return null after analysis. Just because we are returning null in other LAF's we should not right away return null here, it needs more analysis.
Useful link about how Windows desktop properties are mapped : https://docs.oracle.com/javase/8/docs/technotes/guides/swing/1.4/w2k_props.html
-------------
PR: https://git.openjdk.org/jdk/pull/10385
More information about the client-libs-dev
mailing list