Changeset 1865 in josm for trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java
- Timestamp:
- 2009-07-28T19:48:39+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java
r1742 r1865 36 36 import org.openstreetmap.josm.data.osm.visitor.MapPaintVisitor; 37 37 import org.openstreetmap.josm.gui.MapScaler; 38 import org.openstreetmap.josm.gui.OptionPaneUtil; 38 39 import org.openstreetmap.josm.gui.dialogs.ConflictDialog; 39 40 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; … … 81 82 Map<String, String> colorKeyList_layer = new TreeMap<String, String>(); 82 83 for(String key : colorMap.keySet()) { 83 if(key.startsWith("layer ")) 84 if(key.startsWith("layer ")) { 84 85 colorKeyList_layer.put(getName(key), key); 85 else if(key.startsWith("mappaint."))86 } else if(key.startsWith("mappaint.")) { 86 87 colorKeyList_mappaint.put(getName(key), key); 87 else88 } else { 88 89 colorKeyList.put(getName(key), key); 90 } 89 91 } 90 92 for (Entry<String, String> k : colorKeyList.entrySet()) { … … 155 157 int sel = colors.getSelectedRow(); 156 158 JColorChooser chooser = new JColorChooser((Color)colors.getValueAt(sel, 1)); 157 int answer = JOptionPane.showConfirmDialog(gui, chooser, 158 tr("Choose a color for {0}", getName((String)colors.getValueAt(sel, 0))), 159 JOptionPane.OK_CANCEL_OPTION); 160 if (answer == JOptionPane.OK_OPTION) 159 int answer = OptionPaneUtil.showConfirmationDialog( 160 gui, chooser, 161 tr("Choose a color for {0}", getName((String)colors.getValueAt(sel, 0))), 162 JOptionPane.OK_CANCEL_OPTION, 163 JOptionPane.PLAIN_MESSAGE); 164 if (answer == JOptionPane.OK_OPTION) { 161 165 colors.setValueAt(chooser.getColor(), sel, 1); 166 } 162 167 } 163 168 }); … … 168 173 String name = (String)colors.getValueAt(sel, 0); 169 174 Color c = Main.pref.getDefaultColor(name); 170 if (c != null) 175 if (c != null) { 171 176 colors.setValueAt(c, sel, 1); 177 } 172 178 } 173 179 }); … … 177 183 for(int i = 0; i < colors.getRowCount(); ++i) 178 184 { 179 String name = (String)colors.getValueAt(i, 0); 180 Color c = Main.pref.getDefaultColor(name); 181 if (c != null) 182 colors.setValueAt(c, i, 1); 185 String name = (String)colors.getValueAt(i, 0); 186 Color c = Main.pref.getDefaultColor(name); 187 if (c != null) { 188 colors.setValueAt(c, i, 1); 189 } 183 190 } 184 191 } … … 257 264 public boolean ok() { 258 265 Boolean ret = false; 259 for(String d : del) 266 for(String d : del) { 260 267 Main.pref.put("color."+d, null); 268 } 261 269 for (int i = 0; i < colors.getRowCount(); ++i) { 262 270 String key = (String)colors.getValueAt(i, 0); 263 271 if(Main.pref.putColor(key, (Color)colors.getValueAt(i, 1))) 264 272 { 265 if(key.startsWith("mappaint.")) 273 if(key.startsWith("mappaint.")) { 266 274 ret = true; 275 } 267 276 } 268 277 }
Note:
See TracChangeset
for help on using the changeset viewer.