RFR: 8287912: GTK L&F : Background of tree icons are red

Damon Nguyen dnguyen at openjdk.org
Fri Sep 2 01:17:09 UTC 2022


On Thu, 1 Sep 2022 16:56:00 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> The background of tree icons are not red in GTK LAF when setOpaque is set to false for tree component.
>> It has been observed that while painting tree cell background in GTK LAF, a rectangular area is also painted with background color (white). 
>> 
>> Proposed solution is to check the opacity of tree component before drawing tree cell background. If the opacity is set to "false" then the background shouldn't be painted.
>> 
>> An automated test case has been added and checked in CI, link is added in JBS.
>
> test/jdk/javax/swing/JTree/TestTreeBackgroundColor.java line 81:
> 
>> 79:                     if (c.equals(Color.RED)) {
>> 80:                         passed = true;
>> 81:                     }
> 
> better to check at midpoint tree.width/2, tree.height/2 and also break if it's RED, no need to check all pixels.

Another possible solution that I used in a previous test was a midpoint as suggested, but also one pixel near each edge. This eliminates the chance of the red still existing but not being detected at the midpoint because the red is at a different location.

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

PR: https://git.openjdk.org/jdk/pull/10112



More information about the client-libs-dev mailing list