RFR: 8258979: The image didn't show correctly with GTK LAF [v4]

Prasanta Sadhukhan psadhukhan at openjdk.org
Wed Jan 10 12:34:26 UTC 2024


On Wed, 10 Jan 2024 12:20:28 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:

>> src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTreeUI.java line 82:
>> 
>>> 80:     private Icon expandedIconWrapper = new IconWrapper(IconType.EXPANDED);
>>> 81: 
>>> 82:     private Icon collapsedIconWrapper = new IconWrapper(IconType.COLLAPSED);
>> 
>> I guess you can pass in `collapsedIcon` or `expandedIcon`  to `IconWrapper `class which can save it in `icon` field and
>> Then IconWrapper class can just call `SynthGraphicsUtils.paintIcon(icon, context, g, x, y, w, h);`
>
> I tried with this approach first but images didn't render at all.

I guess those might be null at class initialisation stage so it didn't render..you can try 

expandedIconWrapper = new IconWrapper(expandedIcon);
collapsedIconWrappr - new IconWrapper(collapsedICon);

in updateStyle() where it sets

setExpandedIcon(style.getIcon(context, "Tree.expandedIcon"));
setCollapsedIcon(style.getIcon(context, "Tree.collapsedIcon"));

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17294#discussion_r1447325540


More information about the client-libs-dev mailing list