Changeset 4374


Ignore:
Timestamp:
10/15/03 12:07:24 (19 years ago)
Author:
piso
Message:

paint(): make sure key text is grayed out when menu item is disabled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/j/MenuItem.java

    r3076 r4374  
    33 *
    44 * Copyright (C) 1998-2003 Peter Graves
    5  * $Id: MenuItem.java,v 1.3 2003-07-25 17:47:12 piso Exp $
     5 * $Id: MenuItem.java,v 1.4 2003-10-15 12:07:24 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3939        UIManager.getFont("MenuItem.acceleratorFont");
    4040    private static final Color acceleratorForeground =
    41          UIManager.getColor("MenuItem.acceleratorForeground");
     41        UIManager.getColor("MenuItem.acceleratorForeground");
    4242    private static final Color acceleratorSelectionForeground =
    4343        UIManager.getColor("MenuItem.acceleratorSelectionForeground");
     44    private static final Color disabledForeground =
     45        UIManager.getColor("MenuItem.disabledForeground");
    4446
    4547    private final String acceleratorText;
     
    6769        if (acceleratorText != null) {
    6870            g.setFont(acceleratorFont);
    69             g.setColor(getModel().isArmed() ? acceleratorSelectionForeground : acceleratorForeground);
     71            Color c;
     72            if (isEnabled())
     73                c = getModel().isArmed() ? acceleratorSelectionForeground : acceleratorForeground;
     74            else
     75                c = disabledForeground;
     76            g.setColor(c);
    7077            FontMetrics fm = g.getFontMetrics();
    7178            Insets insets = getInsets();
Note: See TracChangeset for help on using the changeset viewer.