Ignore:
Timestamp:
2009-07-28T19:48:39+02:00 (15 years ago)
Author:
Gubaer
Message:

replaced JOptionPane.show* by OptionPaneUtil.show*
ExtendeDialog now always on top, too

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java

    r1742 r1865  
    3636import org.openstreetmap.josm.data.osm.visitor.MapPaintVisitor;
    3737import org.openstreetmap.josm.gui.MapScaler;
     38import org.openstreetmap.josm.gui.OptionPaneUtil;
    3839import org.openstreetmap.josm.gui.dialogs.ConflictDialog;
    3940import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
     
    8182        Map<String, String> colorKeyList_layer = new TreeMap<String, String>();
    8283        for(String key : colorMap.keySet()) {
    83             if(key.startsWith("layer "))
     84            if(key.startsWith("layer ")) {
    8485                colorKeyList_layer.put(getName(key), key);
    85             else if(key.startsWith("mappaint."))
     86            } else if(key.startsWith("mappaint.")) {
    8687                colorKeyList_mappaint.put(getName(key), key);
    87             else
     88            } else {
    8889                colorKeyList.put(getName(key), key);
     90            }
    8991        }
    9092        for (Entry<String, String> k : colorKeyList.entrySet()) {
     
    155157                int sel = colors.getSelectedRow();
    156158                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) {
    161165                    colors.setValueAt(chooser.getColor(), sel, 1);
     166                }
    162167            }
    163168        });
     
    168173                String name = (String)colors.getValueAt(sel, 0);
    169174                Color c = Main.pref.getDefaultColor(name);
    170                 if (c != null)
     175                if (c != null) {
    171176                    colors.setValueAt(c, sel, 1);
     177                }
    172178            }
    173179        });
     
    177183                for(int i = 0; i < colors.getRowCount(); ++i)
    178184                {
    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                    }
    183190                }
    184191            }
     
    257264    public boolean ok() {
    258265        Boolean ret = false;
    259         for(String d : del)
     266        for(String d : del) {
    260267            Main.pref.put("color."+d, null);
     268        }
    261269        for (int i = 0; i < colors.getRowCount(); ++i) {
    262270            String key = (String)colors.getValueAt(i, 0);
    263271            if(Main.pref.putColor(key, (Color)colors.getValueAt(i, 1)))
    264272            {
    265                 if(key.startsWith("mappaint."))
     273                if(key.startsWith("mappaint.")) {
    266274                    ret = true;
     275                }
    267276            }
    268277        }
Note: See TracChangeset for help on using the changeset viewer.