<Swing Dev> RFR: 8268084: [macos] Disabled JMenuItem arrow is not disabled [v2]

Sergey Bylokhov serb at openjdk.java.net
Thu Sep 2 18:13:28 UTC 2021


On Thu, 2 Sep 2021 12:41:58 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> It is seen in macos disabled JMenuItem arrow is not disabled even though JMenuItem itself is disabled.
>> In native app, same menuitem arrow is disabled for disabled menuitem.
>> 
>> Issue is when AquaMenuPainter#paintMenuItem() is called, it tries to draw a ImageIcon image of the arrow via ImageIcon#paintIcon which tries to generate MultiResolutionCachedImage via getResolutionVariant() by calling AquaUtils#generateFilteredImage.
>> It does not take into account if disabled arrow icon image needs to be drawn or not, so it is always enabled.
>> 
>> Proposed fix is to generate a disabled ImageIcon image of the same arrow icon and use it for disabled state.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Cache icon

src/java.desktop/macosx/classes/com/apple/laf/AquaMenuPainter.java line 419:

> 417:             } else {
> 418:                 arrowIcon.paintIcon(c, g, arrowIconRect.x, arrowIconRect.y);
> 419:             }

It will be even better to implement it in the same way as done in other L&fs like windows/metal.

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

PR: https://git.openjdk.java.net/jdk/pull/5310


More information about the swing-dev mailing list