RFR: 8075917: The regression-swing case failed as the text on label is not painted red with the GTK L&F [v5]

Alexey Ivanov aivanov at openjdk.org
Mon Mar 11 13:37:57 UTC 2024


On Tue, 5 Mar 2024 05:28:01 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:

>> JLabel text is not painted with the LAF defined foreground color in GTK LAF. In GTK LAF the foreground color is retrieved by using native system APIs. Fix is to return the foreground color if it is set by LAF defined property otherwise return the default color by calling native APIs.
>> Applet based test has been converted to automatic test and check for all installed LAFs. CI testing is green for test suite and individual test. Link attached in JBS.
>
> Abhishek Kumar has updated the pull request incrementally with one additional commit since the last revision:
> 
>   separate method to get LAF defined color

src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java line 186:

> 184: 
> 185:         if (id == Region.LABEL && type == ColorType.FOREGROUND
> 186:                 && (state & SynthConstants.ENABLED) != 0) {

Doesn't `SynthConstants.DISABLED` need the same treatment?

test/jdk/javax/swing/plaf/basic/BasicHTML/bug4248210.java line 111:

> 109: 
> 110:     private static boolean chkImgForegroundColor(BufferedImage img) {
> 111:         Color red = new Color(255, 0, 0);

I believe you should be using `labelColor` here. If anyone changes its value from `Color.RED` to anything else, the test will fail but it shouldn't. After all, why allowing configuring the colour in first place.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/17763#discussion_r1519714194
PR Review Comment: https://git.openjdk.org/jdk/pull/17763#discussion_r1519712200


More information about the client-libs-dev mailing list