From 45abd4ad692cd7f6dad5c1d1087ca6ff40cdf63c Mon Sep 17 00:00:00 2001 From: weisj <31143295+weisJ@users.noreply.github.com> Date: Thu, 5 Aug 2021 14:31:59 +0200 Subject: [PATCH] Menu: Paint with disabled foreground if model is enabled but the menu item not Fixes #260 --- .../java/com/github/weisj/darklaf/ui/menu/MenuItemUI.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/menu/MenuItemUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/menu/MenuItemUI.java index 61c80afa..90933f61 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/menu/MenuItemUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/menu/MenuItemUI.java @@ -171,7 +171,7 @@ public interface MenuItemUI { ButtonModel model = menuItem.getModel(); FontMetrics fm = SwingUtil.getFontMetrics(menuItem, g); int mnemIndex = menuItem.getDisplayedMnemonicIndex(); - if (!model.isEnabled()) { + if (!model.isEnabled() || !menuItem.isEnabled()) { g.setColor(getDisabledForeground()); } else { if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) { @@ -197,7 +197,7 @@ public interface MenuItemUI { default Color getAcceleratorForeground(final AbstractButton b) { ButtonModel model = b.getModel(); - if (!model.isEnabled()) return getDisabledForeground(); + if (!model.isEnabled() || !b.isEnabled()) return getDisabledForeground(); if (model.isArmed() || (b instanceof JMenu && model.isSelected())) { return getAcceleratorSelectionForeground(); } else {