Ticket #19819: JOSM-NamedColor-from-Laf.diff
File JOSM-NamedColor-from-Laf.diff, 1.5 KB (added by , 5 years ago) |
---|
-
src/org/openstreetmap/josm/data/preferences/NamedColorProperty.java
5 5 import java.util.Arrays; 6 6 import java.util.List; 7 7 8 import javax.swing.UIManager; 9 8 10 import org.openstreetmap.josm.tools.CheckParameterUtil; 9 11 import org.openstreetmap.josm.tools.ColorHelper; 10 12 … … 36 38 * @param defaultValue the default value, can be null 37 39 */ 38 40 public NamedColorProperty(String category, String source, String name, Color defaultValue) { 39 super(getKey(category, source, name), defaultValue);41 super(getKey(category, source, name), getUIColor("JOSM." + getKey(category, source, name), defaultValue)); 40 42 CheckParameterUtil.ensureParameterNotNull(category, "category"); 41 43 CheckParameterUtil.ensureParameterNotNull(name, "name"); 42 44 this.category = category; … … 59 61 return NAMED_COLOR_PREFIX + category + "." + (source == null ? "" : source + ".") + name; 60 62 } 61 63 64 private static Color getUIColor(String uiKey, Color defaultValue) { 65 Color color = UIManager.getColor(uiKey); 66 return (color != null) ? color : defaultValue; 67 } 68 62 69 private List<String> getDefaultValuePref() { 63 70 return defaultValue == null ? null : getValuePref(defaultValue, category, source, name); 64 71 }