On Tue, 31 Aug 2021 06:09:38 GMT, Prasanta Sadhukhan <psadhuk...@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.

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

> 299:                 arrowIcon = new ImageIconUIResource(GrayFilter.
> 300:                         
> createDisabledImage(((ImageIcon)arrowIcon).getImage()));
> 301:             }

Maybe we do not need to duplicate LookAndFeel.getDisabledIcon() here and create 
a new disabled icon on each call for each menu item?
What about tweak the aqua arrow icon, so it will paint itself correctly for 
enabled/disabled states. Similar to how the MenuArrowIcon from the 
WindowsLookAndFeel and MetalLookAndFeel works.

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

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

Reply via email to