Changeset 17118 in josm for trunk/src


Ignore:
Timestamp:
2020-10-08T20:26:02+02:00 (4 years ago)
Author:
simon04
Message:

see #19819 - NamedColorProperty: obtain fallback color using UIManager (patch by DevCharly)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/preferences/NamedColorProperty.java

    r16843 r17118  
    3737     */
    3838    public NamedColorProperty(String category, String source, String name, Color defaultValue) {
    39         super(getKey(category, source, name), defaultValue);
     39        super(getKey(category, source, name), getUIColor("JOSM." + getKey(category, source, name), defaultValue));
    4040        CheckParameterUtil.ensureParameterNotNull(category, "category");
    4141        CheckParameterUtil.ensureParameterNotNull(name, "name");
     
    5858        CheckParameterUtil.ensureParameterNotNull(name, "name");
    5959        return NAMED_COLOR_PREFIX + category + "." + (source == null ? "" : source + ".") + name;
     60    }
     61
     62    private static Color getUIColor(String uiKey, Color defaultValue) {
     63        Color color = UIManager.getColor(uiKey);
     64        return color != null ? color : defaultValue;
    6065    }
    6166
Note: See TracChangeset for help on using the changeset viewer.