Browse Source

Menu: Paint with disabled foreground if model is enabled but the menu item not

Fixes #260
macos/dialog_size
weisj 3 years ago
parent
commit
45abd4ad69
No known key found for this signature in database
GPG Key ID: 31124CB75461DA2A
  1. 4
      core/src/main/java/com/github/weisj/darklaf/ui/menu/MenuItemUI.java

4
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 {

Loading…
Cancel
Save