<Swing Dev> RFR: 8268084: [macos] Disabled JMenuItem arrow is not disabled
Sergey Bylokhov
serb at openjdk.java.net
Wed Sep 1 23:59:31 UTC 2021
On Tue, 31 Aug 2021 06:09:38 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.
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
More information about the swing-dev
mailing list