Index: /trunk/src/org/openstreetmap/josm/actions/SelectAllAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/SelectAllAction.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/actions/SelectAllAction.java	(revision 1865)
@@ -7,6 +7,4 @@
 import java.awt.event.KeyEvent;
 
-import org.openstreetmap.josm.gui.layer.Layer;
-import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener;
 import org.openstreetmap.josm.tools.Shortcut;
 
Index: /trunk/src/org/openstreetmap/josm/actions/UnselectAllAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/UnselectAllAction.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/actions/UnselectAllAction.java	(revision 1865)
@@ -6,9 +6,8 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
+
 import javax.swing.JComponent;
 
 import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.gui.layer.Layer;
-import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener;
 import org.openstreetmap.josm.tools.Shortcut;
 
Index: /trunk/src/org/openstreetmap/josm/actions/UpdateDataAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/UpdateDataAction.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/actions/UpdateDataAction.java	(revision 1865)
@@ -16,6 +16,4 @@
 import org.openstreetmap.josm.data.osm.DataSource;
 import org.openstreetmap.josm.gui.OptionPaneUtil;
-import org.openstreetmap.josm.gui.layer.Layer;
-import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener;
 import org.openstreetmap.josm.tools.Shortcut;
 
Index: /trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java	(revision 1865)
@@ -14,11 +14,8 @@
 
 import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.SelectionChangedListener;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.gui.PleaseWaitRunnable;
-import org.openstreetmap.josm.gui.layer.Layer;
-import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener;
 import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
@@ -63,5 +60,5 @@
     protected void handleUpdateException(Exception e) {
         e.printStackTrace();
-        JOptionPane.showMessageDialog(
+        OptionPaneUtil.showMessageDialog(
                 Main.parent,
                 tr("Failed to update the selected primitives."),
@@ -78,5 +75,5 @@
      */
     protected void handleMissingPrimitive(long id) {
-        JOptionPane.showMessageDialog(
+        OptionPaneUtil.showMessageDialog(
                 Main.parent,
                 tr("Could not find primitive with id {0} in the current dataset", new Long(id).toString()),
@@ -114,5 +111,5 @@
                     msg = lastException.toString();
                 }
-                JOptionPane.showMessageDialog(
+                OptionPaneUtil.showMessageDialog(
                         Main.map,
                         msg,
Index: /trunk/src/org/openstreetmap/josm/actions/UploadAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 1865)
@@ -169,5 +169,10 @@
             return;
         if (Main.map == null) {
-            JOptionPane.showMessageDialog(Main.parent,tr("Nothing to upload. Get some data first."));
+            OptionPaneUtil.showMessageDialog(
+                    Main.parent,
+                    tr("Nothing to upload. Get some data first."),
+                    tr("Warning"),
+                    JOptionPane.WARNING_MESSAGE
+            );
             return;
         }
@@ -203,5 +208,10 @@
 
         if (add.isEmpty() && update.isEmpty() && delete.isEmpty()) {
-            JOptionPane.showMessageDialog(Main.parent,tr("No changes to upload."));
+            OptionPaneUtil.showMessageDialog(
+                    Main.parent,
+                    tr("No changes to upload."),
+                    tr("Warning"),
+                    JOptionPane.WARNING_MESSAGE
+            );
             return;
         }
@@ -350,5 +360,5 @@
         );
         int optionsType = JOptionPane.YES_NO_CANCEL_OPTION;
-        int ret = JOptionPane.showOptionDialog(
+        int ret = OptionPaneUtil.showOptionDialog(
                 null,
                 msg,
@@ -356,5 +366,4 @@
                 optionsType,
                 JOptionPane.ERROR_MESSAGE,
-                null,
                 options,
                 defaultOption
@@ -390,5 +399,5 @@
         );
         int optionsType = JOptionPane.YES_NO_OPTION;
-        int ret = JOptionPane.showOptionDialog(
+        int ret = OptionPaneUtil.showOptionDialog(
                 null,
                 msg,
@@ -396,5 +405,4 @@
                 optionsType,
                 JOptionPane.ERROR_MESSAGE,
-                null,
                 options,
                 defaultOption
@@ -433,5 +441,5 @@
      */
     protected void handlePreconditionFailed(OsmApiException e) {
-        JOptionPane.showMessageDialog(
+        OptionPaneUtil.showMessageDialog(
                 Main.parent,
                 tr("<html>Uploading to the server <strong>failed</strong> because your current<br>"
@@ -483,5 +491,5 @@
                 e.getMessage().replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
         );
-        JOptionPane.showMessageDialog(
+        OptionPaneUtil.showMessageDialog(
                 Main.parent,
                 msg,
@@ -558,5 +566,5 @@
                         ex.getDisplayMessage()
                 );
-                JOptionPane.showMessageDialog(
+                OptionPaneUtil.showMessageDialog(
                         Main.map,
                         msg,
@@ -575,5 +583,5 @@
         }
         e.printStackTrace();
-        JOptionPane.showMessageDialog(
+        OptionPaneUtil.showMessageDialog(
                 Main.map,
                 msg,
@@ -589,5 +597,5 @@
      */
     protected void handleOsmApiInitializationException(OsmApiInitializationException e) {
-        JOptionPane.showMessageDialog(
+        OptionPaneUtil.showMessageDialog(
                 Main.parent,
                 tr(   "Failed to initialize communication with the OSM server {0}.\n"
Index: /trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java	(revision 1865)
@@ -13,5 +13,4 @@
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.command.DeleteCommand;
-import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Relation;
Index: /trunk/src/org/openstreetmap/josm/data/ServerSidePreferences.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/ServerSidePreferences.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/data/ServerSidePreferences.java	(revision 1865)
@@ -106,5 +106,10 @@
         } catch (MalformedURLException e) {
             e.printStackTrace();
-            JOptionPane.showMessageDialog(Main.parent, tr("Could not load preferences from server."));
+            OptionPaneUtil.showMessageDialog(
+                    Main.parent,
+                    tr("Could not load preferences from server."),
+                    tr("Error"),
+                    JOptionPane.ERROR_MESSAGE
+            );
         }
         this.connection = connection;
Index: /trunk/src/org/openstreetmap/josm/gui/BookmarkList.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/BookmarkList.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/BookmarkList.java	(revision 1865)
@@ -37,9 +37,15 @@
         model.removeAllElements();
         try {
-            for (Preferences.Bookmark b : Main.pref.loadBookmarks())
+            for (Preferences.Bookmark b : Main.pref.loadBookmarks()) {
                 model.addElement(b);
+            }
         } catch (IOException e) {
             e.printStackTrace();
-            JOptionPane.showMessageDialog(Main.parent, tr("Could not read bookmarks.")+"\n"+e.getMessage());
+            OptionPaneUtil.showMessageDialog(
+                    Main.parent,
+                    tr("<html>Could not read bookmarks.<br>{0}</html>", e.getMessage()),
+                    tr("Error"),
+                    JOptionPane.ERROR_MESSAGE
+            );
         }
     }
@@ -51,9 +57,15 @@
         try {
             Collection<Preferences.Bookmark> bookmarks = new LinkedList<Preferences.Bookmark>();
-            for (Object o : ((DefaultListModel)getModel()).toArray())
+            for (Object o : ((DefaultListModel)getModel()).toArray()) {
                 bookmarks.add((Preferences.Bookmark)o);
+            }
             Main.pref.saveBookmarks(bookmarks);
         } catch (IOException e) {
-            JOptionPane.showMessageDialog(Main.parent,tr("Could not write bookmark.")+"\n"+e.getMessage());
+            OptionPaneUtil.showMessageDialog(
+                    Main.parent,
+                    tr("<html>Could not write bookmark.<br>{0}</html>", e.getMessage()),
+                    tr("Error"),
+                    JOptionPane.ERROR_MESSAGE
+            );
         }
     }
Index: /trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java	(revision 1865)
@@ -67,9 +67,4 @@
         bTexts = buttonTexts;
         setupDialog(lbl, buttonIcons);
-        try {
-            setAlwaysOnTop(true);
-        } catch(SecurityException e) {
-            System.out.println(tr("Warning: failed to put extended dialog always on top. Exception was: {0}", e.toString()));
-        }
         setVisible(true);
     }
@@ -143,4 +138,12 @@
         setSize(d);
         setLocationRelativeTo(parent);
+
+        // try to put always on top
+        //
+        try {
+            setAlwaysOnTop(true);
+        } catch(SecurityException e) {
+            System.out.println(tr("Warning: failed to bring extended dialog always on top. Exception: {0}", e.toString()));
+        }
     }
 
Index: /trunk/src/org/openstreetmap/josm/gui/OptionPaneUtil.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/OptionPaneUtil.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/OptionPaneUtil.java	(revision 1865)
@@ -7,6 +7,9 @@
 import java.awt.HeadlessException;
 
+import javax.swing.Icon;
 import javax.swing.JDialog;
 import javax.swing.JOptionPane;
+import javax.swing.JRootPane;
+import javax.swing.UIManager;
 
 import org.openstreetmap.josm.Main;
@@ -212,3 +215,95 @@
         return JOptionPane.CLOSED_OPTION;
     }
+
+    /**
+     * Shows a dialog requesting input from the user parented to
+     * <code>parentComponent</code> with the dialog having the title
+     * <code>title</code> and message type <code>messageType</code>.
+     *
+     * @param parentComponent  the parent <code>Component</code> for the
+     *          dialog
+     * @param message  the <code>Object</code> to display
+     * @param title    the <code>String</code> to display in the dialog
+     *          title bar
+     * @param messageType the type of message that is to be displayed:
+     *                  <code>ERROR_MESSAGE</code>,
+     *          <code>INFORMATION_MESSAGE</code>,
+     *          <code>WARNING_MESSAGE</code>,
+     *                  <code>QUESTION_MESSAGE</code>,
+     *          or <code>PLAIN_MESSAGE</code>
+     * @exception HeadlessException if
+     *   <code>GraphicsEnvironment.isHeadless</code> returns
+     *   <code>true</code>
+     * @see java.awt.GraphicsEnvironment#isHeadless
+     */
+    public static String showInputDialog(Component parentComponent,
+            Object message, String title, int messageType)
+    throws HeadlessException {
+        return (String)showInputDialog(parentComponent, message, title,
+                messageType, null, null, null);
+    }
+
+    /**
+     * Prompts the user for input in a blocking dialog where the
+     * initial selection, possible selections, and all other options can
+     * be specified. The user will able to choose from
+     * <code>selectionValues</code>, where <code>null</code> implies the
+     * user can input
+     * whatever they wish, usually by means of a <code>JTextField</code>.
+     * <code>initialSelectionValue</code> is the initial value to prompt
+     * the user with. It is up to the UI to decide how best to represent
+     * the <code>selectionValues</code>, but usually a
+     * <code>JComboBox</code>, <code>JList</code>, or
+     * <code>JTextField</code> will be used.
+     *
+     * @param parentComponent  the parent <code>Component</code> for the
+     *          dialog
+     * @param message  the <code>Object</code> to display
+     * @param title    the <code>String</code> to display in the
+     *          dialog title bar
+     * @param messageType the type of message to be displayed:
+     *                  <code>ERROR_MESSAGE</code>,
+     *          <code>INFORMATION_MESSAGE</code>,
+     *          <code>WARNING_MESSAGE</code>,
+     *                  <code>QUESTION_MESSAGE</code>,
+     *          or <code>PLAIN_MESSAGE</code>
+     * @param icon     the <code>Icon</code> image to display
+     * @param selectionValues an array of <code>Object</code>s that
+     *          gives the possible selections
+     * @param initialSelectionValue the value used to initialize the input
+     *                 field
+     * @return user's input, or <code>null</code> meaning the user
+     *          canceled the input
+     * @exception HeadlessException if
+     *   <code>GraphicsEnvironment.isHeadless</code> returns
+     *   <code>true</code>
+     * @see java.awt.GraphicsEnvironment#isHeadless
+     */
+    public static Object showInputDialog(Component parentComponent,
+            Object message, String title, int messageType, Icon icon,
+            Object[] selectionValues, Object initialSelectionValue)
+    throws HeadlessException {
+        JOptionPane    pane = new JOptionPane(message, messageType,
+                JOptionPane.OK_CANCEL_OPTION, icon,
+                null, null);
+
+        pane.setWantsInput(true);
+        pane.setSelectionValues(selectionValues);
+        pane.setInitialSelectionValue(initialSelectionValue);
+        pane.setComponentOrientation(((parentComponent == null) ?
+                JOptionPane.getRootFrame() : parentComponent).getComponentOrientation());
+
+        JDialog dialog = pane.createDialog(parentComponent, title);
+        // this shows the dialog always on top and brings it to front
+        //
+        prepareDialog(dialog);
+        pane.selectInitialValue();
+        dialog.setVisible(true);
+        dialog.dispose();
+
+        Object value = pane.getInputValue();
+        if (value == JOptionPane.UNINITIALIZED_VALUE)
+            return null;
+        return value;
+    }
 }
Index: /trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java	(revision 1865)
@@ -87,5 +87,9 @@
                     return;
                 }
-                tempBookmark.name = JOptionPane.showInputDialog(Main.parent,tr("Please enter a name for the location."));
+                tempBookmark.name = OptionPaneUtil.showInputDialog(
+                        Main.parent,tr("Please enter a name for the location."),
+                        tr("Name of location"),
+                        JOptionPane.QUESTION_MESSAGE
+                );
                 if (tempBookmark.name != null && !tempBookmark.name.equals("")) {
                     ((DefaultListModel)bookmarks.getModel()).addElement(tempBookmark);
Index: /trunk/src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java	(revision 1865)
@@ -70,4 +70,5 @@
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.gui.PleaseWaitRunnable;
 import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
@@ -125,7 +126,6 @@
             if (cachedImageRef != null) {
                 Image cachedImage = cachedImageRef.get();
-                if (cachedImage != null) {
+                if (cachedImage != null)
                     return cachedImage;
-                }
             }
             return Toolkit.getDefaultToolkit().createImage(currentEntry.file.getAbsolutePath());
@@ -147,7 +147,6 @@
         }
         private void loadImage() {
-            if (currentEntry != null) {
+            if (currentEntry != null)
                 return;
-            }
             while (!queue.isEmpty()) {
                 currentEntry = queue.get(0);
@@ -217,7 +216,6 @@
 
             while (true) {
-                if (entry.scaledImage != null) {
+                if (entry.scaledImage != null)
                     return entry.scaledImage;
-                }
                 try {
                     wait();
@@ -259,9 +257,8 @@
 
         public Image getIcon() {
-            if (icon.scaledImage == null) {
+            if (icon.scaledImage == null)
                 return EMPTY_IMAGE;
-            } else {
+            else
                 return icon.scaledImage;
-            }
         }
 
@@ -330,6 +327,7 @@
             ArrayList<ImageEntry> data = new ArrayList<ImageEntry>(files.size());
             for (File f : files) {
-                if (progressMonitor.isCancelled())
+                if (progressMonitor.isCancelled()) {
                     break;
+                }
                 progressMonitor.subTask(tr("Reading {0}...",f.getName()));
 
@@ -341,6 +339,7 @@
                     continue;
                 }
-                if (e.time == null)
+                if (e.time == null) {
                     continue;
+                }
 
                 data.add(e);
@@ -350,6 +349,7 @@
         }
         @Override protected void finish() {
-            if (layer != null)
+            if (layer != null) {
                 Main.main.addLayer(layer);
+            }
         }
         @Override
@@ -412,6 +412,7 @@
                     return;
                 mousePressed  = true;
-                if (visible)
+                if (visible) {
                     Main.map.mapView.repaint();
+                }
             }
             @Override public void mouseReleased(MouseEvent ev) {
@@ -423,6 +424,7 @@
                 for (int i = data.size(); i > 0; --i) {
                     ImageEntry e = data.get(i-1);
-                    if (e.pos == null)
+                    if (e.pos == null) {
                         continue;
+                    }
                     Point p = Main.map.mapView.getPoint(e.pos);
                     Rectangle r = new Rectangle(p.x-ICON_SIZE/2, p.y-ICON_SIZE/2, ICON_SIZE, ICON_SIZE);
@@ -440,6 +442,7 @@
             public void layerAdded(Layer newLayer) {}
             public void layerRemoved(Layer oldLayer) {
-                if (oldLayer == self)
+                if (oldLayer == self) {
                     Main.map.mapView.removeMouseListener(mouseAdapter);
+                }
             }
         });
@@ -550,12 +553,14 @@
             nextButton.setEnabled(currentImage < data.size() - 1);
 
-            if (scaleToggle.getModel().isSelected())
+            if (scaleToggle.getModel().isSelected()) {
                 imageLabel.setIcon(new ImageIcon(imageLoader.waitForImage(currentImageEntry.image,
                         Math.max(imageViewport.getWidth(), imageViewport.getHeight()))));
-            else
+            } else {
                 imageLabel.setIcon(new ImageIcon(imageLoader.waitForImage(currentImageEntry.image)));
-
-            if (centerToggle.getModel().isSelected())
+            }
+
+            if (centerToggle.getModel().isSelected()) {
                 Main.map.mapView.zoomTo(currentImageEntry.pos);
+            }
 
             dlg.setTitle(currentImageEntry.image +
@@ -594,6 +599,7 @@
                 setIcon(new ImageIcon(e.getIcon()));
                 setText(e.image.getName()+" ("+dateFormat.format(new Date(e.time.getTime()+(delta+gpstimezone)))+")");
-                if (e.pos == null)
+                if (e.pos == null) {
                     setForeground(Color.red);
+                }
                 return this;
             }
@@ -607,6 +613,7 @@
         int i = 0;
         for (ImageEntry e : data)
-            if (e.pos != null)
+            if (e.pos != null) {
                 i++;
+            }
         return data.size()+" "+trn("image","images",data.size())+". "+tr("{0} within the track.",i);
     }
@@ -662,6 +669,7 @@
 
     @Override public void visitBoundingBox(BoundingXYVisitor v) {
-        for (ImageEntry e : data)
+        for (ImageEntry e : data) {
             v.visit(e.pos);
+        }
     }
 
@@ -723,9 +731,19 @@
             exifDate = ExifReader.readTime(f);
         } catch (ParseException e) {
-            JOptionPane.showMessageDialog(Main.parent, tr("The date in file \"{0}\" could not be parsed.", f.getName()));
+            OptionPaneUtil.showMessageDialog(
+                    Main.parent,
+                    tr("The date in file \"{0}\" could not be parsed.", f.getName()),
+                    tr("Error"),
+                    JOptionPane.ERROR_MESSAGE
+            );
             return;
         }
         if (exifDate == null) {
-            JOptionPane.showMessageDialog(Main.parent, tr("There is no EXIF time within the file \"{0}\".", f.getName()));
+            OptionPaneUtil.showMessageDialog(
+                    Main.parent,
+                    tr("There is no EXIF time within the file \"{0}\".", f.getName()),
+                    tr("Error"),
+                    JOptionPane.ERROR_MESSAGE
+            );
             return;
         }
@@ -738,11 +756,18 @@
         p.add(new JLabel(tr("GPS unit timezone (difference to photo)")), GBC.eol());
         String t = Main.pref.get("tagimages.gpstimezone", "0");
-        if (t.charAt(0) != '-')
+        if (t.charAt(0) != '-') {
             t = "+"+t;
+        }
         JTextField gpsTimezone = new JTextField(t);
         p.add(gpsTimezone, GBC.eol().fill(GBC.HORIZONTAL));
 
         while (true) {
-            int answer = JOptionPane.showConfirmDialog(Main.parent, p, tr("Synchronize Time with GPS Unit"), JOptionPane.OK_CANCEL_OPTION);
+            int answer = OptionPaneUtil.showConfirmationDialog(
+                    Main.parent,
+                    p,
+                    tr("Synchronize Time with GPS Unit"),
+                    JOptionPane.OK_CANCEL_OPTION,
+                    JOptionPane.QUESTION_MESSAGE
+            );
             if (answer != JOptionPane.OK_OPTION || gpsText.getText().equals(""))
                 return;
@@ -750,8 +775,10 @@
                 delta = DateParser.parse(gpsText.getText()).getTime() - exifDate.getTime();
                 String time = gpsTimezone.getText();
-                if (!time.equals("") && time.charAt(0) == '+')
+                if (!time.equals("") && time.charAt(0) == '+') {
                     time = time.substring(1);
-                if (time.equals(""))
+                }
+                if (time.equals("")) {
                     time = "0";
+                }
                 gpstimezone = Long.valueOf(time)*60*60*1000;
                 Main.pref.put("tagimages.delta", ""+delta);
@@ -760,7 +787,17 @@
                 return;
             } catch (NumberFormatException x) {
-                JOptionPane.showMessageDialog(Main.parent, tr("Time entered could not be parsed."));
+                OptionPaneUtil.showMessageDialog(
+                        Main.parent,
+                        tr("Time entered could not be parsed."),
+                        tr("Error"),
+                        JOptionPane.ERROR_MESSAGE
+                );
             } catch (ParseException x) {
-                JOptionPane.showMessageDialog(Main.parent, tr("Time entered could not be parsed."));
+                OptionPaneUtil.showMessageDialog(
+                        Main.parent,
+                        tr("Time entered could not be parsed."),
+                        tr("Error"),
+                        JOptionPane.ERROR_MESSAGE
+                );
             }
         }
Index: /trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java	(revision 1865)
@@ -59,4 +59,5 @@
 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
 import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
 import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
@@ -99,18 +100,20 @@
     }
 
-    @Override public Icon getIcon() {
+    @Override
+    public Icon getIcon() {
         return ImageProvider.get("layer", "gpx_small");
     }
 
-    @Override public Object getInfoComponent() {
+    @Override
+    public Object getInfoComponent() {
         return getToolTipText();
     }
 
-    static public Color getColor(String name)
-    {
-        return Main.pref.getColor(marktr("gps point"), name != null ? "layer "+name : null, Color.gray);
-    }
-
-    @Override public Component[] getMenuEntries() {
+    static public Color getColor(String name) {
+        return Main.pref.getColor(marktr("gps point"), name != null ? "layer " + name : null, Color.gray);
+    }
+
+    @Override
+    public Component[] getMenuEntries() {
         JMenuItem line = new JMenuItem(tr("Customize line drawing"), ImageProvider.get("mapmode/addsegment"));
         line.addActionListener(new ActionListener() {
@@ -126,13 +129,19 @@
                     panel.add(b);
                 }
-                String propName = "draw.rawgps.lines.layer "+name;
+                String propName = "draw.rawgps.lines.layer " + name;
                 if (Main.pref.hasKey(propName)) {
-                    group.setSelected(r[Main.pref.getBoolean(propName) ? 1:2].getModel(), true);
+                    group.setSelected(r[Main.pref.getBoolean(propName) ? 1 : 2].getModel(), true);
                 } else {
                     group.setSelected(r[0].getModel(), true);
                 }
-                int answer = JOptionPane.showConfirmDialog(Main.parent, panel, tr("Select line drawing options"), JOptionPane.OK_CANCEL_OPTION);
-                if (answer == JOptionPane.CANCEL_OPTION)
-                    return;
+                int answer = OptionPaneUtil.showConfirmationDialog(Main.parent, panel,
+                        tr("Select line drawing options"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
+                switch (answer) {
+                    case JOptionPane.CANCEL_OPTION:
+                    case JOptionPane.CLOSED_OPTION:
+                        return;
+                    default:
+                        // continue
+                }
                 if (group.getSelection() == r[0].getModel()) {
                     Main.pref.put(propName, null);
@@ -149,16 +158,22 @@
             public void actionPerformed(ActionEvent e) {
                 JColorChooser c = new JColorChooser(getColor(name));
-                Object[] options = new Object[]{tr("OK"), tr("Cancel"), tr("Default")};
-                int answer = JOptionPane.showOptionDialog(Main.parent, c, tr("Choose a color"), JOptionPane.OK_CANCEL_OPTION,
-                        JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
+                Object[] options = new Object[] { tr("OK"), tr("Cancel"), tr("Default") };
+                int answer = OptionPaneUtil.showOptionDialog(
+                        Main.parent,
+                        c,
+                        tr("Choose a color"),
+                        JOptionPane.OK_CANCEL_OPTION,
+                        JOptionPane.PLAIN_MESSAGE,
+                        options, options[0]
+                );
                 switch (answer) {
-                case 0:
-                    Main.pref.putColor("layer "+name, c.getColor());
-                    break;
-                case 1:
-                    return;
-                case 2:
-                    Main.pref.putColor("layer "+name, null);
-                    break;
+                    case 0:
+                        Main.pref.putColor("layer " + name, c.getColor());
+                        break;
+                    case 1:
+                        return;
+                    case 2:
+                        Main.pref.putColor("layer " + name, null);
+                        break;
                 }
                 Main.map.repaint();
@@ -166,5 +181,6 @@
         });
 
-        JMenuItem markersFromNamedTrackpoints = new JMenuItem(tr("Markers From Named Points"), ImageProvider.get("addmarkers"));
+        JMenuItem markersFromNamedTrackpoints = new JMenuItem(tr("Markers From Named Points"), ImageProvider
+                .get("addmarkers"));
         markersFromNamedTrackpoints.putClientProperty("help", "Action/MarkersFromNamedPoints");
         markersFromNamedTrackpoints.addActionListener(new ActionListener() {
@@ -180,5 +196,6 @@
                 }
 
-                MarkerLayer ml = new MarkerLayer(namedTrackPoints, tr("Named Trackpoints from {0}", name), getAssociatedFile(), me);
+                MarkerLayer ml = new MarkerLayer(namedTrackPoints, tr("Named Trackpoints from {0}", name),
+                        getAssociatedFile(), me);
                 if (ml.data.size() > 0) {
                     Main.main.addLayer(ml);
@@ -195,14 +212,17 @@
                 fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
                 fc.setAcceptAllFileFilterUsed(false);
-                fc.setFileFilter(new FileFilter(){
-                    @Override public boolean accept(File f) {
+                fc.setFileFilter(new FileFilter() {
+                    @Override
+                    public boolean accept(File f) {
                         return f.isDirectory() || f.getName().toLowerCase().endsWith(".wav");
                     }
-                    @Override public String getDescription() {
+
+                    @Override
+                    public String getDescription() {
                         return tr("Wave Audio files (*.wav)");
                     }
                 });
                 fc.setMultiSelectionEnabled(true);
-                if(fc.showOpenDialog(Main.parent) == JFileChooser.APPROVE_OPTION) {
+                if (fc.showOpenDialog(Main.parent) == JFileChooser.APPROVE_OPTION) {
                     if (!fc.getCurrentDirectory().getAbsolutePath().equals(dir)) {
                         Main.pref.put("markers.lastaudiodirectory", fc.getCurrentDirectory().getAbsolutePath());
@@ -210,6 +230,7 @@
 
                     File sel[] = fc.getSelectedFiles();
-                    if(sel != null) {
-                        // sort files in increasing order of timestamp (this is the end time, but so long as they don't overlap, that's fine)
+                    if (sel != null) {
+                        // sort files in increasing order of timestamp (this is the end time, but so
+                        // long as they don't overlap, that's fine)
                         if (sel.length > 1) {
                             Arrays.sort(sel, new Comparator<File>() {
@@ -223,5 +244,5 @@
                     String names = null;
                     for (int i = 0; i < sel.length; i++) {
-                        if(names == null) {
+                        if (names == null) {
                             names = " (";
                         } else {
@@ -230,5 +251,5 @@
                         names += sel[i].getName();
                     }
-                    if(names != null) {
+                    if (names != null) {
                         names += ")";
                     } else {
@@ -237,7 +258,7 @@
                     MarkerLayer ml = new MarkerLayer(new GpxData(), tr("Audio markers from {0}", name) + names,
                             getAssociatedFile(), me);
-                    if(sel != null)
-                    {
-                        double firstStartTime = sel[0].lastModified()/1000.0 /* ms -> seconds */ - AudioUtil.getCalibratedDuration(sel[0]);
+                    if (sel != null) {
+                        double firstStartTime = sel[0].lastModified() / 1000.0 /* ms -> seconds */
+                        - AudioUtil.getCalibratedDuration(sel[0]);
                         for (int i = 0; i < sel.length; i++) {
                             importAudio(sel[i], ml, firstStartTime);
@@ -259,8 +280,11 @@
                 fc.setAcceptAllFileFilterUsed(false);
                 fc.setFileFilter(new FileFilter() {
-                    @Override public boolean accept(File f) {
+                    @Override
+                    public boolean accept(File f) {
                         return f.isDirectory() || f.getName().toLowerCase().endsWith(".jpg");
                     }
-                    @Override public String getDescription() {
+
+                    @Override
+                    public String getDescription() {
                         return tr("JPEG images (*.jpg)");
                     }
@@ -288,41 +312,25 @@
 
         if (Main.applet)
-            return new Component[] {
-                new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
-                new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),
-                new JSeparator(),
-                color,
-                line,
-                new JMenuItem(new ConvertToDataLayerAction()),
-                new JSeparator(),
-                new JMenuItem(new RenameLayerAction(getAssociatedFile(), this)),
-                new JSeparator(),
-                new JMenuItem(new LayerListPopup.InfoAction(this))};
-        return new Component[] {
-                new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
-                new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),
-                new JSeparator(),
-                new JMenuItem(new LayerSaveAction(this)),
-                new JMenuItem(new LayerSaveAsAction(this)),
-                color,
-                line,
-                tagimage,
-                importAudio,
-                markersFromNamedTrackpoints,
-                new JMenuItem(new ConvertToDataLayerAction()),
-                new JMenuItem(new DownloadAlongTrackAction()),
-                new JSeparator(),
-                new JMenuItem(new RenameLayerAction(getAssociatedFile(), this)),
-                new JSeparator(),
-                new JMenuItem(new LayerListPopup.InfoAction(this))};
-    }
-
-    @Override public String getToolTipText() {
+            return new Component[] { new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
+                new JMenuItem(new LayerListDialog.DeleteLayerAction(this)), new JSeparator(), color, line,
+                new JMenuItem(new ConvertToDataLayerAction()), new JSeparator(),
+                new JMenuItem(new RenameLayerAction(getAssociatedFile(), this)), new JSeparator(),
+                new JMenuItem(new LayerListPopup.InfoAction(this)) };
+        return new Component[] { new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
+                new JMenuItem(new LayerListDialog.DeleteLayerAction(this)), new JSeparator(),
+                new JMenuItem(new LayerSaveAction(this)), new JMenuItem(new LayerSaveAsAction(this)), color, line,
+                tagimage, importAudio, markersFromNamedTrackpoints, new JMenuItem(new ConvertToDataLayerAction()),
+                new JMenuItem(new DownloadAlongTrackAction()), new JSeparator(),
+                new JMenuItem(new RenameLayerAction(getAssociatedFile(), this)), new JSeparator(),
+                new JMenuItem(new LayerListPopup.InfoAction(this)) };
+    }
+
+    @Override
+    public String getToolTipText() {
         StringBuilder info = new StringBuilder().append("<html>");
 
-        info.append(trn("{0} track, ", "{0} tracks, ",
-                data.tracks.size(), data.tracks.size())).append(trn("{0} route, ", "{0} routes, ",
-                        data.routes.size(), data.routes.size())).append(trn("{0} waypoint", "{0} waypoints",
-                                data.waypoints.size(), data.waypoints.size())).append("<br>");
+        info.append(trn("{0} track, ", "{0} tracks, ", data.tracks.size(), data.tracks.size())).append(
+                trn("{0} route, ", "{0} routes, ", data.routes.size(), data.routes.size())).append(
+                        trn("{0} waypoint", "{0} waypoints", data.waypoints.size(), data.waypoints.size())).append("<br>");
 
         if (data.attr.containsKey("name")) {
@@ -334,18 +342,18 @@
         }
 
-        if(data.tracks.size() > 0){
+        if (data.tracks.size() > 0) {
             boolean first = true;
             WayPoint earliest = null, latest = null;
 
-            for(GpxTrack trk: data.tracks){
-                for(Collection<WayPoint> seg:trk.trackSegs){
-                    for(WayPoint pnt:seg){
-                        if(first){
+            for (GpxTrack trk : data.tracks) {
+                for (Collection<WayPoint> seg : trk.trackSegs) {
+                    for (WayPoint pnt : seg) {
+                        if (first) {
                             latest = earliest = pnt;
                             first = false;
-                        }else{
-                            if(pnt.compareTo(earliest) < 0){
+                        } else {
+                            if (pnt.compareTo(earliest) < 0) {
                                 earliest = pnt;
-                            }else{
+                            } else {
                                 latest = pnt;
                             }
@@ -356,8 +364,8 @@
             if (earliest != null && latest != null) {
                 DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);
-                info.append(tr("Timespan: ") + df.format(new Date((long)(earliest.time * 1000))) + " - "
-                        + df.format(new Date((long)(latest.time * 1000))));
-                int diff = (int)(latest.time - earliest.time);
-                info.append(" (" + (diff / 3600) + ":" + ((diff % 3600)/60) + ")");
+                info.append(tr("Timespan: ") + df.format(new Date((long) (earliest.time * 1000))) + " - "
+                        + df.format(new Date((long) (latest.time * 1000))));
+                int diff = (int) (latest.time - earliest.time);
+                info.append(" (" + (diff / 3600) + ":" + ((diff % 3600) / 60) + ")");
                 info.append("<br>");
             }
@@ -369,10 +377,12 @@
     }
 
-    @Override public boolean isMergable(Layer other) {
+    @Override
+    public boolean isMergable(Layer other) {
         return other instanceof GpxLayer;
     }
 
-    @Override public void mergeFrom(Layer from) {
-        data.mergeFrom(((GpxLayer)from).data);
+    @Override
+    public void mergeFrom(Layer from) {
+        data.mergeFrom(((GpxLayer) from).data);
         computeCacheInSync = false;
     }
@@ -381,5 +391,5 @@
     static {
         for (int i = 0; i < colors.length; i++) {
-            colors[i] = Color.getHSBColor(i/300.0f, 1, 1);
+            colors[i] = Color.getHSBColor(i / 300.0f, 1, 1);
         }
     }
@@ -389,23 +399,16 @@
     private static int sl4 = 5;
     private static int sl9 = 3;
-    private static int[][] dir = {
-        {+sl4,+ll0,+ll0,+sl4},
-        {-sl9,+ll0,+sl9,+ll0},
-        {-ll0,+sl4,-sl4,+ll0},
-        {-ll0,-sl9,-ll0,+sl9},
-        {-sl4,-ll0,-ll0,-sl4},
-        {+sl9,-ll0,-sl9,-ll0},
-        {+ll0,-sl4,+sl4,-ll0},
-        {+ll0,+sl9,+ll0,-sl9},
-        {+sl4,+ll0,+ll0,+sl4},
-        {-sl9,+ll0,+sl9,+ll0},
-        {-ll0,+sl4,-sl4,+ll0},
-        {-ll0,-sl9,-ll0,+sl9}
-    };
+    private static int[][] dir = { { +sl4, +ll0, +ll0, +sl4 }, { -sl9, +ll0, +sl9, +ll0 }, { -ll0, +sl4, -sl4, +ll0 },
+        { -ll0, -sl9, -ll0, +sl9 }, { -sl4, -ll0, -ll0, -sl4 }, { +sl9, -ll0, -sl9, -ll0 },
+        { +ll0, -sl4, +sl4, -ll0 }, { +ll0, +sl9, +ll0, -sl9 }, { +sl4, +ll0, +ll0, +sl4 },
+        { -sl9, +ll0, +sl9, +ll0 }, { -ll0, +sl4, -sl4, +ll0 }, { -ll0, -sl9, -ll0, +sl9 } };
 
     // the different color modes
-    enum colorModes { none, velocity, dilution }
-
-    @Override public void paint(Graphics g, MapView mv) {
+    enum colorModes {
+        none, velocity, dilution
+    }
+
+    @Override
+    public void paint(Graphics g, MapView mv) {
 
         /****************************************************************
@@ -426,6 +429,7 @@
         }
         // draw line between points, global setting
-        boolean lines = (Main.pref.getBoolean("draw.rawgps.lines", true) || (Main.pref.getBoolean("draw.rawgps.lines.localfiles") && this.isLocalFile));
-        String linesKey = "draw.rawgps.lines.layer "+name;
+        boolean lines = (Main.pref.getBoolean("draw.rawgps.lines", true) || (Main.pref
+                .getBoolean("draw.rawgps.lines.localfiles") && this.isLocalFile));
+        String linesKey = "draw.rawgps.lines.layer " + name;
         // draw lines, per-layer setting
         if (Main.pref.hasKey(linesKey)) {
@@ -438,5 +442,6 @@
         try {
             colored = colorModes.values()[Main.pref.getInteger("draw.rawgps.colors", 0)];
-        } catch(Exception e) { }
+        } catch (Exception e) {
+        }
         // paint direction arrow with alternate math. may be faster
         boolean alternatedirection = Main.pref.getBoolean("draw.rawgps.alternatedirection");
@@ -448,9 +453,11 @@
          ********** STEP 2a - CHECK CACHE VALIDITY **********************
          ****************************************************************/
-        if (computeCacheInSync && ((computeCacheMaxLineLengthUsed != maxLineLength) ||
-                (!neutralColor.equals(computeCacheColorUsed)) ||
-                (computeCacheColored != colored) ||
-                (computeCacheColorTracksTune != colorTracksTune))) {
-            //          System.out.println("(re-)computing gpx line styles, reason: CCIS=" + computeCacheInSync + " CCMLLU=" + (computeCacheMaxLineLengthUsed != maxLineLength) + " CCCU=" +  (!neutralColor.equals(computeCacheColorUsed)) + " CCC=" + (computeCacheColored != colored));
+        if (computeCacheInSync
+                && ((computeCacheMaxLineLengthUsed != maxLineLength) || (!neutralColor.equals(computeCacheColorUsed))
+                        || (computeCacheColored != colored) || (computeCacheColorTracksTune != colorTracksTune))) {
+            // System.out.println("(re-)computing gpx line styles, reason: CCIS=" +
+            // computeCacheInSync + " CCMLLU=" + (computeCacheMaxLineLengthUsed != maxLineLength) +
+            // " CCCU=" + (!neutralColor.equals(computeCacheColorUsed)) + " CCC=" +
+            // (computeCacheColored != colored));
             computeCacheMaxLineLengthUsed = maxLineLength;
             computeCacheInSync = false;
@@ -479,35 +486,35 @@
                             double dist = c.greatCircleDistance(oldWp.getCoor());
 
-                            switch(colored) {
-                            case velocity:
-                                double dtime = trkPnt.time - oldWp.time;
-                                double vel = dist/dtime;
-                                double velColor = vel/colorTracksTune*255;
-                                // Bad case first
-                                if (dtime <= 0 || vel < 0 || velColor > 255) {
-                                    trkPnt.customColoring = colors[255];
-                                } else {
-                                    trkPnt.customColoring = colors[(int) (velColor)];
-                                }
-                                break;
-
-                            case dilution:
-                                if(trkPnt.attr.get("hdop") != null) {
-                                    float hdop = ((Float)trkPnt.attr.get("hdop")).floatValue();
-                                    if (hdop < 0) {
-                                        hdop = 0;
+                            switch (colored) {
+                                case velocity:
+                                    double dtime = trkPnt.time - oldWp.time;
+                                    double vel = dist / dtime;
+                                    double velColor = vel / colorTracksTune * 255;
+                                    // Bad case first
+                                    if (dtime <= 0 || vel < 0 || velColor > 255) {
+                                        trkPnt.customColoring = colors[255];
+                                    } else {
+                                        trkPnt.customColoring = colors[(int) (velColor)];
                                     }
-                                    int hdoplvl = Math.round(hdop * Main.pref.getInteger("hdop.factor", 25));
-                                    // High hdop is bad, but high values in colors are green.
-                                    // Therefore inverse the logic
-                                    int hdopcolor = 255 - (hdoplvl > 255 ? 255 : hdoplvl);
-                                    trkPnt.customColoring = colors[hdopcolor];
-                                }
-                                break;
+                                    break;
+
+                                case dilution:
+                                    if (trkPnt.attr.get("hdop") != null) {
+                                        float hdop = ((Float) trkPnt.attr.get("hdop")).floatValue();
+                                        if (hdop < 0) {
+                                            hdop = 0;
+                                        }
+                                        int hdoplvl = Math.round(hdop * Main.pref.getInteger("hdop.factor", 25));
+                                        // High hdop is bad, but high values in colors are green.
+                                        // Therefore inverse the logic
+                                        int hdopcolor = 255 - (hdoplvl > 255 ? 255 : hdoplvl);
+                                        trkPnt.customColoring = colors[hdopcolor];
+                                    }
+                                    break;
                             }
 
                             if (maxLineLength == -1 || dist <= maxLineLength) {
                                 trkPnt.drawLine = true;
-                                trkPnt.dir = (int)oldWp.getCoor().heading(trkPnt.getCoor());
+                                trkPnt.dir = (int) oldWp.getCoor().heading(trkPnt.getCoor());
                             } else {
                                 trkPnt.drawLine = false;
@@ -565,11 +572,13 @@
                             Point screen = mv.getPoint(trkPnt.getEastNorth());
                             // skip points that are on the same screenposition
-                            if (old != null && (oldA == null || screen.x < oldA.x-delta || screen.x > oldA.x+delta || screen.y < oldA.y-delta || screen.y > oldA.y+delta)) {
+                            if (old != null
+                                    && (oldA == null || screen.x < oldA.x - delta || screen.x > oldA.x + delta
+                                            || screen.y < oldA.y - delta || screen.y > oldA.y + delta)) {
                                 g.setColor(trkPnt.customColoring);
-                                double t = Math.atan2(screen.y-old.y, screen.x-old.x) + Math.PI;
-                                g.drawLine(screen.x,screen.y, (int)(screen.x + 10*Math.cos(t-PHI)), (int)(screen.y
-                                        + 10*Math.sin(t-PHI)));
-                                g.drawLine(screen.x,screen.y, (int)(screen.x + 10*Math.cos(t+PHI)), (int)(screen.y
-                                        + 10*Math.sin(t+PHI)));
+                                double t = Math.atan2(screen.y - old.y, screen.x - old.x) + Math.PI;
+                                g.drawLine(screen.x, screen.y, (int) (screen.x + 10 * Math.cos(t - PHI)),
+                                        (int) (screen.y + 10 * Math.sin(t - PHI)));
+                                g.drawLine(screen.x, screen.y, (int) (screen.x + 10 * Math.cos(t + PHI)),
+                                        (int) (screen.y + 10 * Math.sin(t + PHI)));
                                 oldA = screen;
                             }
@@ -597,8 +606,12 @@
                             Point screen = mv.getPoint(trkPnt.getEastNorth());
                             // skip points that are on the same screenposition
-                            if (old != null && (oldA == null || screen.x < oldA.x-delta || screen.x > oldA.x+delta || screen.y < oldA.y-delta || screen.y > oldA.y+delta)) {
+                            if (old != null
+                                    && (oldA == null || screen.x < oldA.x - delta || screen.x > oldA.x + delta
+                                            || screen.y < oldA.y - delta || screen.y > oldA.y + delta)) {
                                 g.setColor(trkPnt.customColoring);
-                                g.drawLine(screen.x, screen.y, screen.x + dir[trkPnt.dir][0], screen.y + dir[trkPnt.dir][1]);
-                                g.drawLine(screen.x, screen.y, screen.x + dir[trkPnt.dir][2], screen.y + dir[trkPnt.dir][3]);
+                                g.drawLine(screen.x, screen.y, screen.x + dir[trkPnt.dir][0], screen.y
+                                        + dir[trkPnt.dir][1]);
+                                g.drawLine(screen.x, screen.y, screen.x + dir[trkPnt.dir][2], screen.y
+                                        + dir[trkPnt.dir][3]);
                                 oldA = screen;
                             }
@@ -624,5 +637,5 @@
                         Point screen = mv.getPoint(trkPnt.getEastNorth());
                         g.setColor(trkPnt.customColoring);
-                        g.fillRect(screen.x-1, screen.y-1, 3, 3);
+                        g.fillRect(screen.x - 1, screen.y - 1, 3, 3);
                     } // end for trkpnt
                 } // end for segment
@@ -633,5 +646,5 @@
          ********** STEP 3e - DRAW SMALL POINTS FOR LINES ***************
          ****************************************************************/
-        if (!large && lines){
+        if (!large && lines) {
             g.setColor(neutralColor);
             for (GpxTrack trk : data.tracks) {
@@ -654,5 +667,5 @@
          ********** STEP 3f - DRAW SMALL POINTS INSTEAD OF LINES ********
          ****************************************************************/
-        if (!large && !lines){
+        if (!large && !lines) {
             g.setColor(neutralColor);
             for (GpxTrack trk : data.tracks) {
@@ -671,9 +684,10 @@
         } // end if large
 
-        //Long duration = System.currentTimeMillis() - startTime;
-        //System.out.println(duration);
+        // Long duration = System.currentTimeMillis() - startTime;
+        // System.out.println(duration);
     } // end paint
 
-    @Override public void visitBoundingBox(BoundingXYVisitor v) {
+    @Override
+    public void visitBoundingBox(BoundingXYVisitor v) {
         v.visit(data.recalculateBounds());
     }
@@ -683,16 +697,15 @@
             super(tr("Convert to data layer"), ImageProvider.get("converttoosm"));
         }
+
         public void actionPerformed(ActionEvent e) {
             JPanel msg = new JPanel(new GridBagLayout());
-            msg.add(new JLabel(tr("<html>Upload of unprocessed GPS data as map data is considered harmful.<br>If you want to upload traces, look here:")), GBC.eol());
+            msg
+            .add(
+                    new JLabel(
+                            tr("<html>Upload of unprocessed GPS data as map data is considered harmful.<br>If you want to upload traces, look here:")),
+                            GBC.eol());
             msg.add(new UrlLabel(tr("http://www.openstreetmap.org/traces")), GBC.eop());
-            if (!ConditionalOptionPaneUtil.showConfirmationDialog(
-                    "convert_to_data",
-                    Main.parent,
-                    msg,
-                    tr("Warning"),
-                    JOptionPane.OK_CANCEL_OPTION,
-                    JOptionPane.WARNING_MESSAGE,
-                    JOptionPane.OK_OPTION))
+            if (!ConditionalOptionPaneUtil.showConfirmationDialog("convert_to_data", Main.parent, msg, tr("Warning"),
+                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, JOptionPane.OK_OPTION))
                 return;
             DataSet ds = new DataSet();
@@ -703,6 +716,5 @@
                         Node n = new Node(p.getCoor());
                         String timestr = p.getString("time");
-                        if(timestr != null)
-                        {
+                        if (timestr != null) {
                             n.setTimestamp(DateUtils.fromString(timestr));
                         }
@@ -713,6 +725,6 @@
                 }
             }
-            Main.main.addLayer(new OsmDataLayer(ds, tr("Converted from: {0}", GpxLayer.this.name),
-                    getAssociatedFile()));
+            Main.main
+            .addLayer(new OsmDataLayer(ds, tr("Converted from: {0}", GpxLayer.this.name), getAssociatedFile()));
             Main.main.removeLayer(GpxLayer.this);
         }
@@ -720,11 +732,16 @@
 
     @Override
-    public File getAssociatedFile() { return data.storageFile; }
+    public File getAssociatedFile() {
+        return data.storageFile;
+    }
+
     @Override
-    public void setAssociatedFile(File file) { data.storageFile = file; }
+    public void setAssociatedFile(File file) {
+        data.storageFile = file;
+    }
 
     /**
      * Action that issues a series of download requests to the API, following the GPX track.
-     *
+     * 
      * @author fred
      */
@@ -733,12 +750,13 @@
             super(tr("Download from OSM along this track"), ImageProvider.get("downloadalongtrack"));
         }
+
         public void actionPerformed(ActionEvent e) {
             JPanel msg = new JPanel(new GridBagLayout());
-            Integer dist[] = {5000, 500, 50};
-            Integer area[] = {20, 10, 5, 1};
+            Integer dist[] = { 5000, 500, 50 };
+            Integer area[] = { 20, 10, 5, 1 };
 
             msg.add(new JLabel(tr("Download everything within:")), GBC.eol());
             String s[] = new String[dist.length];
-            for(int i = 0; i < dist.length; ++i) {
+            for (int i = 0; i < dist.length; ++i) {
                 s[i] = tr("{0} meters", dist[i]);
             }
@@ -747,5 +765,5 @@
             msg.add(new JLabel(tr("Maximum area per request:")), GBC.eol());
             s = new String[area.length];
-            for(int i = 0; i < area.length; ++i) {
+            for (int i = 0; i < area.length; ++i) {
                 s[i] = tr("{0} sq km", area[i]);
             }
@@ -753,12 +771,22 @@
             msg.add(maxRect, GBC.eol());
 
-            if (JOptionPane.showConfirmDialog(Main.parent, msg,
+            int ret = OptionPaneUtil.showConfirmationDialog(
+                    Main.parent,
+                    msg,
                     tr("Download from OSM along this track"),
-                    JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION)
-                return;
+                    JOptionPane.OK_CANCEL_OPTION,
+                    JOptionPane.QUESTION_MESSAGE
+            );
+            switch(ret) {
+                case JOptionPane.CANCEL_OPTION:
+                case JOptionPane.CLOSED_OPTION:
+                    return;
+                default:
+                    // continue
+            }
 
             /*
-             * Find the average latitude for the data we're contemplating, so we can
-             * know how many metres per degree of longitude we have.
+             * Find the average latitude for the data we're contemplating, so we can know how many
+             * metres per degree of longitude we have.
              */
             double latsum = 0;
@@ -769,5 +797,5 @@
                     for (WayPoint p : segment) {
                         latsum += p.getCoor().lat();
-                        latcnt ++;
+                        latcnt++;
                     }
                 }
@@ -778,9 +806,8 @@
 
             /*
-             * Compute buffer zone extents and maximum bounding box size. Note that the
-             * maximum we ever offer is a bbox area of 0.002, while the API theoretically
-             * supports 0.25, but as soon as you touch any built-up area, that kind of
-             * bounding box will download forever and then stop because it has more than
-             * 50k nodes.
+             * Compute buffer zone extents and maximum bounding box size. Note that the maximum we
+             * ever offer is a bbox area of 0.002, while the API theoretically supports 0.25, but as
+             * soon as you touch any built-up area, that kind of bounding box will download forever
+             * and then stop because it has more than 50k nodes.
              */
             Integer i = buffer.getSelectedIndex();
@@ -794,7 +821,7 @@
 
             /*
-             * Collect the combined area of all gpx points plus buffer zones around them.
-             * We ignore points that lie closer to the previous point than the given buffer
-             * size because otherwise this operation takes ages.
+             * Collect the combined area of all gpx points plus buffer zones around them. We ignore
+             * points that lie closer to the previous point than the given buffer size because
+             * otherwise this operation takes ages.
              */
             LatLon previous = null;
@@ -805,5 +832,5 @@
                         if (previous == null || c.greatCircleDistance(previous) > buffer_dist) {
                             // we add a buffer around the point.
-                            r.setRect(c.lon()-buffer_x, c.lat()-buffer_y, 2*buffer_x, 2*buffer_y);
+                            r.setRect(c.lon() - buffer_x, c.lat() - buffer_y, 2 * buffer_x, 2 * buffer_y);
                             a.add(new Area(r));
                             previous = c;
@@ -814,23 +841,16 @@
 
             /*
-             * Area "a" now contains the hull that we would like to download data for.
-             * however we can only download rectangles, so the following is an attempt at
-             * finding a number of rectangles to download.
-             *
-             * The idea is simply: Start out with the full bounding box. If it is too large,
-             * then split it in half and repeat recursively for each half until you arrive
-             * at something small enough to download. The algorithm is improved
-             * by always using the intersection between the rectangle and the actual desired
-             * area. For example, if you have a track that goes like this:
-             * +----+
-             * |   /|
-             * |  / |
-             * | /  |
-             * |/   |
-             * +----+
-             * then we would first look at downloading the whole rectangle (assume it's too big),
-             * after that we split it in half (upper and lower half), but we do *not* request the
-             * full upper and lower rectangle, only the part of the upper/lower rectangle that
-             * actually has something in it.
+             * Area "a" now contains the hull that we would like to download data for. however we
+             * can only download rectangles, so the following is an attempt at finding a number of
+             * rectangles to download.
+             * 
+             * The idea is simply: Start out with the full bounding box. If it is too large, then
+             * split it in half and repeat recursively for each half until you arrive at something
+             * small enough to download. The algorithm is improved by always using the intersection
+             * between the rectangle and the actual desired area. For example, if you have a track
+             * that goes like this: +----+ | /| | / | | / | |/ | +----+ then we would first look at
+             * downloading the whole rectangle (assume it's too big), after that we split it in half
+             * (upper and lower half), but we donot request the full upper and lower rectangle, only
+             * the part of the upper/lower rectangle that actually has something in it.
              */
 
@@ -841,12 +861,27 @@
             msg = new JPanel(new GridBagLayout());
 
-            msg.add(new JLabel(tr("<html>This action will require {0} individual<br>download requests. Do you wish<br>to continue?</html>",
-                    toDownload.size())), GBC.eol());
-
-            if (toDownload.size() > 1 && JOptionPane.showConfirmDialog(Main.parent, msg,
-                    tr("Download from OSM along this track"),
-                    JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION)
-                return;
-
+            msg
+            .add(
+                    new JLabel(
+                            tr(
+                                    "<html>This action will require {0} individual<br>download requests. Do you wish<br>to continue?</html>",
+                                    toDownload.size())), GBC.eol());
+
+            if (toDownload.size() > 1) {
+                ret = OptionPaneUtil.showConfirmationDialog(
+                        Main.parent,
+                        msg,
+                        tr("Download from OSM along this track"),
+                        JOptionPane.OK_CANCEL_OPTION,
+                        JOptionPane.PLAIN_MESSAGE
+                );
+                switch(ret) {
+                    case JOptionPane.CANCEL_OPTION:
+                    case JOptionPane.CLOSED_OPTION:
+                        return;
+                    default:
+                        // continue
+                }
+            }
             new DownloadOsmTaskList().download(false, toDownload, new PleaseWaitProgressMonitor());
         }
@@ -857,5 +892,6 @@
         // intersect with sought-after area
         tmp.intersect(a);
-        if (tmp.isEmpty()) return;
+        if (tmp.isEmpty())
+            return;
         Rectangle2D bounds = tmp.getBounds2D();
         if (bounds.getWidth() * bounds.getHeight() > max_area) {
@@ -865,10 +901,12 @@
             if (bounds.getWidth() > bounds.getHeight()) {
                 // rectangles that are wider than high are split into a left and right half,
-                r1 = new Rectangle2D.Double(bounds.getX(), bounds.getY(), bounds.getWidth()/2, bounds.getHeight());
-                r2 = new Rectangle2D.Double(bounds.getX()+bounds.getWidth()/2, bounds.getY(), bounds.getWidth()/2, bounds.getHeight());
+                r1 = new Rectangle2D.Double(bounds.getX(), bounds.getY(), bounds.getWidth() / 2, bounds.getHeight());
+                r2 = new Rectangle2D.Double(bounds.getX() + bounds.getWidth() / 2, bounds.getY(),
+                        bounds.getWidth() / 2, bounds.getHeight());
             } else {
                 // others into a top and bottom half.
-                r1 = new Rectangle2D.Double(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight()/2);
-                r2 = new Rectangle2D.Double(bounds.getX(), bounds.getY()+bounds.getHeight()/2, bounds.getWidth(), bounds.getHeight()/2);
+                r1 = new Rectangle2D.Double(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight() / 2);
+                r2 = new Rectangle2D.Double(bounds.getX(), bounds.getY() + bounds.getHeight() / 2, bounds.getWidth(),
+                        bounds.getHeight() / 2);
             }
             addToDownload(a, r1, results, max_area);
@@ -880,12 +918,9 @@
 
     /**
-     * Makes a new marker layer derived from this GpxLayer containing at least one
-     * audio marker which the given audio file is associated with.
-     * Markers are derived from the following
-     * (a) explict waypoints in the GPX layer, or
-     * (b) named trackpoints in the GPX layer, or
-     * (d) timestamp on the wav file
-     * (e) (in future) voice recognised markers in the sound recording
-     * (f) a single marker at the beginning of the track
+     * Makes a new marker layer derived from this GpxLayer containing at least one audio marker
+     * which the given audio file is associated with. Markers are derived from the following (a)
+     * explict waypoints in the GPX layer, or (b) named trackpoints in the GPX layer, or (d)
+     * timestamp on the wav file (e) (in future) voice recognised markers in the sound recording (f)
+     * a single marker at the beginning of the track
      * @param wavFile : the file to be associated with the markers in the new marker layer
      */
@@ -895,10 +930,14 @@
         boolean timedMarkersOmitted = false;
         boolean untimedMarkersOmitted = false;
-        double snapDistance = Main.pref.getDouble("marker.audiofromuntimedwaypoints.distance", 1.0e-3); /* about 25m */
+        double snapDistance = Main.pref.getDouble("marker.audiofromuntimedwaypoints.distance", 1.0e-3); /*
+         * about
+         * 25
+         * m
+         */
         WayPoint wayPointFromTimeStamp = null;
 
         // determine time of first point in track
         double firstTime = -1.0;
-        if (data.tracks != null && ! data.tracks.isEmpty()) {
+        if (data.tracks != null && !data.tracks.isEmpty()) {
             for (GpxTrack track : data.tracks) {
                 if (track.trackSegs == null) {
@@ -920,12 +959,16 @@
         }
         if (firstTime < 0.0) {
-            JOptionPane.showMessageDialog(Main.parent, tr("No GPX track available in layer to associate audio with."));
+            OptionPaneUtil.showMessageDialog(
+                    Main.parent,
+                    tr("No GPX track available in layer to associate audio with."),
+                    tr("Error"),
+                    JOptionPane.ERROR_MESSAGE
+            );
             return;
         }
 
         // (a) try explicit timestamped waypoints - unless suppressed
-        if (Main.pref.getBoolean("marker.audiofromexplicitwaypoints", true) &&
-                data.waypoints != null && ! data.waypoints.isEmpty())
-        {
+        if (Main.pref.getBoolean("marker.audiofromexplicitwaypoints", true) && data.waypoints != null
+                && !data.waypoints.isEmpty()) {
             for (WayPoint w : data.waypoints) {
                 if (w.time > firstTime) {
@@ -938,9 +981,10 @@
 
         // (b) try explicit waypoints without timestamps - unless suppressed
-        if (Main.pref.getBoolean("marker.audiofromuntimedwaypoints", true) &&
-                data.waypoints != null && ! data.waypoints.isEmpty())
-        {
+        if (Main.pref.getBoolean("marker.audiofromuntimedwaypoints", true) && data.waypoints != null
+                && !data.waypoints.isEmpty()) {
             for (WayPoint w : data.waypoints) {
-                if (waypoints.contains(w)) { continue; }
+                if (waypoints.contains(w)) {
+                    continue;
+                }
                 WayPoint wNear = nearestPointOnTrack(w.getEastNorth(), snapDistance);
                 if (wNear != null) {
@@ -958,7 +1002,6 @@
 
         // (c) use explicitly named track points, again unless suppressed
-        if ((Main.pref.getBoolean("marker.audiofromnamedtrackpoints", false)) &&
-                data.tracks != null && ! data.tracks.isEmpty())
-        {
+        if ((Main.pref.getBoolean("marker.audiofromnamedtrackpoints", false)) && data.tracks != null
+                && !data.tracks.isEmpty()) {
             for (GpxTrack track : data.tracks) {
                 if (track.trackSegs == null) {
@@ -976,12 +1019,12 @@
 
         // (d) use timestamp of file as location on track
-        if ((Main.pref.getBoolean("marker.audiofromwavtimestamps", false)) &&
-                data.tracks != null && ! data.tracks.isEmpty())
-        {
-            double lastModified = wavFile.lastModified() / 1000.0; // lastModified is in milliseconds
+        if ((Main.pref.getBoolean("marker.audiofromwavtimestamps", false)) && data.tracks != null
+                && !data.tracks.isEmpty()) {
+            double lastModified = wavFile.lastModified() / 1000.0; // lastModified is in
+            // milliseconds
             double duration = AudioUtil.getCalibratedDuration(wavFile);
             double startTime = lastModified - duration;
-            startTime = firstStartTime + (startTime - firstStartTime) /
-            Main.pref.getDouble("audio.calibration", "1.0" /* default, ratio */);
+            startTime = firstStartTime + (startTime - firstStartTime)
+            / Main.pref.getDouble("audio.calibration", "1.0" /* default, ratio */);
             WayPoint w1 = null;
             WayPoint w2 = null;
@@ -1008,10 +1051,12 @@
                 timedMarkersOmitted = true;
             } else {
-                wayPointFromTimeStamp = new WayPoint(w1.getCoor().interpolate(
-                        w2.getCoor(), (startTime - w1.time)/(w2.time - w1.time)));
+                wayPointFromTimeStamp = new WayPoint(w1.getCoor().interpolate(w2.getCoor(),
+                        (startTime - w1.time) / (w2.time - w1.time)));
                 wayPointFromTimeStamp.time = startTime;
                 String name = wavFile.getName();
                 int dot = name.lastIndexOf(".");
-                if (dot > 0) { name = name.substring(0, dot); }
+                if (dot > 0) {
+                    name = name.substring(0, dot);
+                }
                 wayPointFromTimeStamp.attr.put("name", name);
                 waypoints.add(wayPointFromTimeStamp);
@@ -1022,7 +1067,6 @@
 
         // (f) simply add a single marker at the start of the track
-        if ((Main.pref.getBoolean("marker.audiofromstart") || waypoints.isEmpty()) &&
-                data.tracks != null && ! data.tracks.isEmpty())
-        {
+        if ((Main.pref.getBoolean("marker.audiofromstart") || waypoints.isEmpty()) && data.tracks != null
+                && !data.tracks.isEmpty()) {
             boolean gotOne = false;
             for (GpxTrack track : data.tracks) {
@@ -1071,7 +1115,9 @@
                 name = AudioMarker.inventName(offset);
             }
-            AudioMarker am = AudioMarker.create(w.getCoor(),
-                    name, uri, ml, w.time, offset);
-            /* timeFromAudio intended for future use to shift markers of this type on synchronization */
+            AudioMarker am = AudioMarker.create(w.getCoor(), name, uri, ml, w.time, offset);
+            /*
+             * timeFromAudio intended for future use to shift markers of this type on
+             * synchronization
+             */
             if (w == wayPointFromTimeStamp) {
                 am.timeFromAudio = true;
@@ -1081,9 +1127,13 @@
 
         if (timedMarkersOmitted) {
-            JOptionPane.showMessageDialog(Main.parent,
+            JOptionPane
+            .showMessageDialog(
+                    Main.parent,
                     tr("Some waypoints with timestamps from before the start of the track or after the end were omitted or moved to the start."));
         }
         if (untimedMarkersOmitted) {
-            JOptionPane.showMessageDialog(Main.parent,
+            JOptionPane
+            .showMessageDialog(
+                    Main.parent,
                     tr("Some waypoints which were too far from the track to sensibly estimate their time were omitted."));
         }
@@ -1091,42 +1141,33 @@
 
     /**
-     * Makes a WayPoint at the projection of point P onto the track providing P is
-     * less than tolerance away from the track
-
+     * Makes a WayPoint at the projection of point P onto the track providing P is less than
+     * tolerance away from the track
+     * 
      * @param P : the point to determine the projection for
      * @param tolerance : must be no further than this from the track
-     * @return the closest point on the track to P, which may be the
-     * first or last point if off the end of a segment, or may be null if
-     * nothing close enough
+     * @return the closest point on the track to P, which may be the first or last point if off the
+     * end of a segment, or may be null if nothing close enough
      */
     public WayPoint nearestPointOnTrack(EastNorth P, double tolerance) {
         /*
-         * assume the coordinates of P are xp,yp, and those of a section of track
-         * between two trackpoints are R=xr,yr and S=xs,ys. Let N be the projected point.
-         *
-         * The equation of RS is Ax + By + C = 0 where
-         * A = ys - yr
-         * B = xr - xs
-         * C = - Axr - Byr
-         *
+         * assume the coordinates of P are xp,yp, and those of a section of track between two
+         * trackpoints are R=xr,yr and S=xs,ys. Let N be the projected point.
+         * 
+         * The equation of RS is Ax + By + C = 0 where A = ys - yr B = xr - xs C = - Axr - Byr
+         * 
          * Also, note that the distance RS^2 is A^2 + B^2
-         *
+         * 
          * If RS^2 == 0.0 ignore the degenerate section of track
-         *
-         * PN^2 = (Axp + Byp + C)^2 / RS^2
-         * that is the distance from P to the line
-         *
-         * so if PN^2 is less than PNmin^2 (initialized to tolerance) we can reject
-         * the line; otherwise...
-         * determine if the projected poijnt lies within the bounds of the line:
-         * PR^2 - PN^2 <= RS^2 and PS^2 - PN^2 <= RS^2
-         *
-         * where PR^2 = (xp - xr)^2 + (yp-yr)^2
-         * and   PS^2 = (xp - xs)^2 + (yp-ys)^2
-         *
-         * If so, calculate N as
-         * xn = xr + (RN/RS) B
-         * yn = y1 + (RN/RS) A
-         *
+         * 
+         * PN^2 = (Axp + Byp + C)^2 / RS^2 that is the distance from P to the line
+         * 
+         * so if PN^2 is less than PNmin^2 (initialized to tolerance) we can reject the line;
+         * otherwise... determine if the projected poijnt lies within the bounds of the line: PR^2 -
+         * PN^2 <= RS^2 and PS^2 - PN^2 <= RS^2
+         * 
+         * where PR^2 = (xp - xr)^2 + (yp-yr)^2 and PS^2 = (xp - xs)^2 + (yp-ys)^2
+         * 
+         * If so, calculate N as xn = xr + (RN/RS) B yn = y1 + (RN/RS) A
+         * 
          * where RN = sqrt(PR^2 - PN^2)
          */
@@ -1138,5 +1179,6 @@
         double py = P.north();
         double rx = 0.0, ry = 0.0, sx, sy, x, y;
-        if (data.tracks == null) return null;
+        if (data.tracks == null)
+            return null;
         for (GpxTrack track : data.tracks) {
             if (track.trackSegs == null) {
@@ -1164,5 +1206,5 @@
                         double A = sy - ry;
                         double B = rx - sx;
-                        double C = - A * rx - B * ry;
+                        double C = -A * rx - B * ry;
                         double RSsq = A * A + B * B;
                         if (RSsq == 0.0) {
@@ -1179,5 +1221,5 @@
                             double PSsq = x * x + y * y;
                             if (PRsq - PNsq <= RSsq && PSsq - PNsq <= RSsq) {
-                                double RNoverRS = Math.sqrt((PRsq - PNsq)/RSsq);
+                                double RNoverRS = Math.sqrt((PRsq - PNsq) / RSsq);
                                 double nx = rx - RNoverRS * B;
                                 double ny = ry + RNoverRS * A;
@@ -1208,5 +1250,6 @@
             }
         }
-        if (bestEN == null) return null;
+        if (bestEN == null)
+            return null;
         WayPoint best = new WayPoint(Main.proj.eastNorth2latlon(bestEN));
         best.time = bestTime;
Index: /trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java	(revision 1865)
@@ -58,4 +58,5 @@
 import org.openstreetmap.josm.data.osm.visitor.SimplePaintVisitor;
 import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
 import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
@@ -295,5 +296,10 @@
         }
         if (numNewConflicts > 0) {
-            JOptionPane.showMessageDialog(Main.parent,tr("There were {0} conflicts during import.", numNewConflicts));
+            OptionPaneUtil.showMessageDialog(
+                    Main.parent,
+                    tr("There were {0} conflicts during import.", numNewConflicts),
+                    tr("Warning"),
+                    JOptionPane.WARNING_MESSAGE
+            );
         }
     }
Index: /trunk/src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java	(revision 1865)
@@ -34,4 +34,5 @@
 import javax.swing.JSeparator;
 import javax.swing.JTextField;
+import javax.swing.text.html.Option;
 
 import org.openstreetmap.josm.Main;
@@ -47,4 +48,5 @@
 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
 import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
 import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
@@ -218,5 +220,11 @@
                     group.setSelected(r[0].getModel(), true);
                 }
-                int answer = JOptionPane.showConfirmDialog(Main.parent, panel, tr("Select line drawing options"), JOptionPane.OK_CANCEL_OPTION);
+                int answer = OptionPaneUtil.showConfirmationDialog(
+                        Main.parent,
+                        panel,
+                        tr("Select line drawing options"),
+                        JOptionPane.OK_CANCEL_OPTION,
+                        JOptionPane.PLAIN_MESSAGE
+                );
                 if (answer == JOptionPane.CANCEL_OPTION)
                     return;
@@ -235,15 +243,19 @@
                 JColorChooser c = new JColorChooser(Main.pref.getColor(marktr("gps point"), "layer "+name, Color.gray));
                 Object[] options = new Object[]{tr("OK"), tr("Cancel"), tr("Default")};
-                int answer = JOptionPane.showOptionDialog(Main.parent, c, tr("Choose a color"), JOptionPane.OK_CANCEL_OPTION,
-                        JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
+                int answer = OptionPaneUtil.showOptionDialog(
+                        Main.parent,
+                        c,
+                        tr("Choose a color"),
+                        JOptionPane.OK_CANCEL_OPTION,
+                        JOptionPane.PLAIN_MESSAGE, options, options[0]);
                 switch (answer) {
-                case 0:
-                    Main.pref.putColor("layer "+name, c.getColor());
-                    break;
-                case 1:
-                    return;
-                case 2:
-                    Main.pref.putColor("layer "+name, null);
-                    break;
+                    case 0:
+                        Main.pref.putColor("layer "+name, c.getColor());
+                        break;
+                    case 1:
+                        return;
+                    case 2:
+                        Main.pref.putColor("layer "+name, null);
+                        break;
                 }
                 Main.map.repaint();
Index: /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java	(revision 1865)
@@ -34,4 +34,5 @@
 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
 import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
 import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
@@ -90,5 +91,7 @@
             if (wpt_has_link) {
                 for (GpxLink oneLink : (Collection<GpxLink>) wpt.attr.get(GpxData.META_LINKS)) {
-                    if (!oneLink.uri.equals(lastLinkedFile))firstTime = time;
+                    if (!oneLink.uri.equals(lastLinkedFile)) {
+                        firstTime = time;
+                    }
                     lastLinkedFile = oneLink.uri;
                     break;
@@ -96,6 +99,7 @@
             }
             Marker m = Marker.createMarker(wpt, indata.storageFile, this, time, time - firstTime);
-            if (m != null)
+            if (m != null) {
                 data.add(m);
+            }
         }
 
@@ -118,6 +122,7 @@
                             return;
                         mousePressed  = true;
-                        if (visible)
+                        if (visible) {
                             Main.map.mapView.repaint();
+                        }
                     }
                     @Override public void mouseReleased(MouseEvent ev) {
@@ -129,6 +134,7 @@
                         if (ev.getPoint() != null) {
                             for (Marker mkr : data) {
-                                if (mkr.containsPoint(ev.getPoint()))
+                                if (mkr.containsPoint(ev.getPoint())) {
                                     mkr.actionPerformed(new ActionEvent(this, 0, null));
+                                }
                             }
                         }
@@ -183,6 +189,7 @@
 
     @Override public void visitBoundingBox(BoundingXYVisitor v) {
-        for (Marker mkr : data)
+        for (Marker mkr : data) {
             v.visit(mkr.getEastNorth());
+        }
     }
 
@@ -198,6 +205,13 @@
                 JColorChooser c = new JColorChooser(getColor(name));
                 Object[] options = new Object[]{tr("OK"), tr("Cancel"), tr("Default")};
-                int answer = JOptionPane.showOptionDialog(Main.parent, c, tr("Choose a color"), JOptionPane.OK_CANCEL_OPTION,
-                JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
+                int answer = OptionPaneUtil.showOptionDialog(
+                        Main.parent,
+                        c,
+                        tr("Choose a color"),
+                        JOptionPane.OK_CANCEL_OPTION,
+                        JOptionPane.PLAIN_MESSAGE,
+                        options,
+                        options[0]
+                );
                 switch (answer) {
                 case 0:
@@ -219,12 +233,27 @@
             public void actionPerformed(ActionEvent e) {
                 if (! AudioPlayer.paused()) {
-                    JOptionPane.showMessageDialog(Main.parent,tr("You need to pause audio at the moment when you hear your synchronization cue."));
+                    OptionPaneUtil.showMessageDialog(
+                            Main.parent,
+                            tr("You need to pause audio at the moment when you hear your synchronization cue."),
+                            tr("Warning"),
+                            JOptionPane.WARNING_MESSAGE
+                    );
                     return;
                 }
                 AudioMarker recent = AudioMarker.recentlyPlayedMarker();
                 if (synchronizeAudioMarkers(recent)) {
-                    JOptionPane.showMessageDialog(Main.parent, tr("Audio synchronized at point {0}.", recent.text));
+                    OptionPaneUtil.showMessageDialog(
+                            Main.parent,
+                            tr("Audio synchronized at point {0}.", recent.text),
+                            tr("Information"),
+                            JOptionPane.INFORMATION_MESSAGE
+                    );
                 } else {
-                    JOptionPane.showMessageDialog(Main.parent,tr("Unable to synchronize in layer being played."));
+                    OptionPaneUtil.showMessageDialog(
+                            Main.parent,
+                            tr("Unable to synchronize in layer being played."),
+                            tr("Error"),
+                            JOptionPane.ERROR_MESSAGE
+                    );
                 }
             }
@@ -236,5 +265,10 @@
             public void actionPerformed(ActionEvent e) {
                 if (! AudioPlayer.paused()) {
-                    JOptionPane.showMessageDialog(Main.parent,tr("You need to have paused audio at the point on the track where you want the marker."));
+                    OptionPaneUtil.showMessageDialog(
+                            Main.parent,
+                            tr("You need to have paused audio at the point on the track where you want the marker."),
+                            tr("Warning"),
+                            JOptionPane.WARNING_MESSAGE
+                    );
                     return;
                 }
@@ -285,10 +319,12 @@
         URL url = startMarker.url();
         for (Marker m : data) {
-            if (m == startMarker)
+            if (m == startMarker) {
                 seenStart = true;
+            }
             if (seenStart) {
                 AudioMarker ma = (AudioMarker) m; // it must be an AudioMarker
-                if (ma.url().equals(url))
+                if (ma.url().equals(url)) {
                     ma.adjustOffset(adjustment);
+                }
             }
         }
@@ -308,5 +344,10 @@
         }
         if (am == null) {
-            JOptionPane.showMessageDialog(Main.parent,tr("No existing audio markers in this layer to offset from."));
+            OptionPaneUtil.showMessageDialog(
+                    Main.parent,
+                    tr("No existing audio markers in this layer to offset from."),
+                    tr("Error"),
+                    JOptionPane.ERROR_MESSAGE
+            );
             return null;
         }
@@ -314,5 +355,5 @@
         // make our new marker
         AudioMarker newAudioMarker = AudioMarker.create(coor,
-            AudioMarker.inventName(offset), AudioPlayer.url().toString(), this, time, offset);
+                AudioMarker.inventName(offset), AudioPlayer.url().toString(), this, time, offset);
 
         // insert it at the right place in a copy the collection
@@ -333,6 +374,7 @@
 
         if (newAudioMarker != null) {
-            if (am != null)
+            if (am != null) {
                 newAudioMarker.adjustOffset(am.syncOffset()); // i.e. same as predecessor
+            }
             newData.add(newAudioMarker); // insert at end
         }
@@ -363,9 +405,10 @@
             for (Marker marker : markerLayer.data) {
                 if (marker == startMarker) {
-                    if (next)
+                    if (next) {
                         nextTime = true;
-                    else {
-                        if (previousMarker == null)
+                    } else {
+                        if (previousMarker == null) {
                             previousMarker = startMarker; // if no previous one, play the first one again
+                        }
                         return previousMarker;
                     }
@@ -389,6 +432,7 @@
             return;
         Layer l = Main.map.mapView.getActiveLayer();
-        if(l != null)
+        if(l != null) {
             m = getAdjacentMarker(startMarker, next, l);
+        }
         if(m == null)
         {
@@ -396,10 +440,12 @@
             {
                 m = getAdjacentMarker(startMarker, next, layer);
-                if(m != null)
-                    break;
-            }
-        }
-        if(m != null)
+                if(m != null) {
+                    break;
+                }
+            }
+        }
+        if(m != null) {
             ((AudioMarker)m).play();
+        }
     }
 
Index: /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java	(revision 1865)
@@ -26,4 +26,5 @@
 import org.openstreetmap.josm.data.gpx.WayPoint;
 import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.gui.layer.GpxLayer;
 import org.openstreetmap.josm.tools.AudioPlayer;
@@ -61,6 +62,6 @@
     private PlayHeadMarker() {
         super(new LatLon(0.0,0.0), "",
-              Main.pref.get("marker.audiotracericon", "audio-tracer"),
-              null, -1.0, 0.0);
+                Main.pref.get("marker.audiotracericon", "audio-tracer"),
+                null, -1.0, 0.0);
         enabled = Main.pref.getBoolean("marker.traceaudio", true);
         if (! enabled) return;
@@ -87,5 +88,5 @@
         Point screen = Main.map.mapView.getPoint(getEastNorth());
         Rectangle r = new Rectangle(screen.x, screen.y, symbol.getIconWidth(),
-        symbol.getIconHeight());
+                symbol.getIconHeight());
         return r.contains(p);
     }
@@ -96,6 +97,7 @@
      */
     public void startDrag() {
-        if (timer != null)
+        if (timer != null) {
             timer.stop();
+        }
         wasPlaying = AudioPlayer.playing();
         if (wasPlaying) {
@@ -109,9 +111,11 @@
      */
     private void endDrag(boolean reset) {
-        if (! wasPlaying || reset)
+        if (! wasPlaying || reset) {
             try { AudioPlayer.pause(); }
             catch (Exception ex) { AudioPlayer.audioMalfunction(ex);}
-        if (reset)
+        }
+        if (reset) {
             setCoor(oldCoor);
+        }
         Main.map.selectMapMode(oldMode);
         Main.map.mapView.repaint();
@@ -153,6 +157,7 @@
                     if (m instanceof AudioMarker) {
                         AudioMarker a = (AudioMarker) m;
-                        if (a.time > cw.time)
+                        if (a.time > cw.time) {
                             break;
+                        }
                         ca = a;
                     }
@@ -163,5 +168,10 @@
         if (ca == null) {
             /* Not close enough to track, or no audio marker found for some other reason */
-            JOptionPane.showMessageDialog(Main.parent, tr("You need to drag the play head near to the GPX track whose associated sound track you were playing (after the first marker)."));
+            OptionPaneUtil.showMessageDialog(
+                    Main.parent,
+                    tr("You need to drag the play head near to the GPX track whose associated sound track you were playing (after the first marker)."),
+                    tr("Warning"),
+                    JOptionPane.WARNING_MESSAGE
+            );
             endDrag(true);
         } else {
@@ -202,5 +212,7 @@
 
         /* We found the closest marker: did we actually hit it? */
-        if (ca != null && ! ca.containsPoint(startPoint)) ca = null;
+        if (ca != null && ! ca.containsPoint(startPoint)) {
+            ca = null;
+        }
 
         /* If we didn't hit an audio marker, we need to create one at the nearest point on the track */
@@ -211,5 +223,10 @@
             WayPoint cw = recent.parentLayer.fromLayer.nearestPointOnTrack(en, enPlus25px.east() - en.east());
             if (cw == null) {
-                JOptionPane.showMessageDialog(Main.parent, tr("You need to SHIFT-drag the play head onto an audio marker or onto the track point where you want to synchronize."));
+                OptionPaneUtil.showMessageDialog(
+                        Main.parent,
+                        tr("You need to SHIFT-drag the play head onto an audio marker or onto the track point where you want to synchronize."),
+                        tr("Warning"),
+                        JOptionPane.WARNING_MESSAGE
+                );
                 endDrag(true);
                 return;
@@ -221,13 +238,28 @@
         if(ca == null)
         {
-            JOptionPane.showMessageDialog(Main.parent,tr("Unable to create new audio marker."));
+            OptionPaneUtil.showMessageDialog(
+                    Main.parent,
+                    tr("Unable to create new audio marker."),
+                    tr("Error"),
+                    JOptionPane.ERROR_MESSAGE
+            );
             endDrag(true);
         }
         else if (recent.parentLayer.synchronizeAudioMarkers(ca)) {
-            JOptionPane.showMessageDialog(Main.parent, tr("Audio synchronized at point {0}.", ca.text));
+            OptionPaneUtil.showMessageDialog(
+                    Main.parent,
+                    tr("Audio synchronized at point {0}.", ca.text),
+                    tr("Information"),
+                    JOptionPane.INFORMATION_MESSAGE
+            );
             setCoor(ca.getCoor());
             endDrag(false);
         } else {
-            JOptionPane.showMessageDialog(Main.parent,tr("Unable to synchronize in layer being played."));
+            OptionPaneUtil.showMessageDialog(
+                    Main.parent,
+                    tr("Unable to synchronize in layer being played."),
+                    tr("Error"),
+                    JOptionPane.ERROR_MESSAGE
+            );
             endDrag(true);
         }
@@ -264,7 +296,7 @@
             return;
         double audioTime = recentlyPlayedMarker.time +
-            AudioPlayer.position() -
-            recentlyPlayedMarker.offset -
-            recentlyPlayedMarker.syncOffset;
+        AudioPlayer.position() -
+        recentlyPlayedMarker.offset -
+        recentlyPlayedMarker.syncOffset;
         if (Math.abs(audioTime - time) < animationInterval)
             return;
@@ -289,7 +321,11 @@
                     w1 = w;
                 }
-                if (w2 != null) break;
-            }
-            if (w2 != null) break;
+                if (w2 != null) {
+                    break;
+                }
+            }
+            if (w2 != null) {
+                break;
+            }
         }
 
@@ -297,7 +333,7 @@
             return;
         setEastNorth(w2 == null ?
-            w1.getEastNorth() :
-            w1.getEastNorth().interpolate(w2.getEastNorth(),
-                    (audioTime - w1.time)/(w2.time - w1.time)));
+                w1.getEastNorth() :
+                    w1.getEastNorth().interpolate(w2.getEastNorth(),
+                            (audioTime - w1.time)/(w2.time - w1.time)));
         time = audioTime;
         Main.map.mapView.repaint();
Index: /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/WebMarker.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/WebMarker.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/WebMarker.java	(revision 1865)
@@ -11,4 +11,5 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.tools.OpenBrowser;
 
@@ -39,5 +40,5 @@
         String error = OpenBrowser.displayUrl(webUrl.toString());
         if (error != null) {
-            JOptionPane.showMessageDialog(Main.parent,
+            OptionPaneUtil.showMessageDialog(Main.parent,
                     "<html><b>" +
                     tr("There was an error while trying to display the URL for this marker") +
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/AdvancedPreference.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/AdvancedPreference.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/AdvancedPreference.java	(revision 1865)
@@ -30,4 +30,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.tools.GBC;
 
@@ -83,5 +84,5 @@
                 {
                     data.put((String) model.getValueAt(row, 0),
-                    (String) model.getValueAt(row, 1));
+                            (String) model.getValueAt(row, 1));
                 }
             }
@@ -89,6 +90,7 @@
         };
         DefaultTableCellRenderer renderer = new DefaultTableCellRenderer(){
+            @Override
             public Component getTableCellRendererComponent(JTable table, Object value,
-                boolean isSelected, boolean hasFocus, int row, int column)
+                    boolean isSelected, boolean hasFocus, int row, int column)
             {
                 JLabel label=new JLabel();
@@ -96,11 +98,12 @@
                 if(s != null)
                 {
-                    if(s.equals(model.getValueAt(row, 1)))
+                    if(s.equals(model.getValueAt(row, 1))) {
                         label.setToolTipText(tr("Current value is default."));
-                    else
+                    } else {
                         label.setToolTipText(tr("Default value is ''{0}''.", s));
-                }
-                else
+                    }
+                } else {
                     label.setToolTipText(tr("Default value currently unknown (setting has not been used yet)."));
+                }
                 label.setText((String)value);
                 return label;
@@ -147,6 +150,7 @@
         list.addMouseListener(new MouseAdapter(){
             @Override public void mouseClicked(MouseEvent e) {
-                if (e.getClickCount() == 2)
+                if (e.getClickCount() == 2) {
                     editPreference(gui, list);
+                }
             }
         });
@@ -157,6 +161,7 @@
         for (String s : defaults.keySet())
         {
-            if(!ts.contains(s))
+            if(!ts.contains(s)) {
                 ts.add(s);
+            }
         }
         data = new TreeMap<String, String>();
@@ -164,5 +169,7 @@
         {
             String val = Main.pref.get(s);
-            if(val == null) val = "";
+            if(val == null) {
+                val = "";
+            }
             data.put(s, val);
         }
@@ -180,6 +187,7 @@
             // Make 'wmsplugin cache' search for e.g. 'cache.wmsplugin'
             for (String bit : input) {
-                if (!prefKey.contains(bit) && !prefValue.contains(bit))
+                if (!prefKey.contains(bit) && !prefValue.contains(bit)) {
                     canHas = false;
+                }
             }
 
@@ -196,11 +204,13 @@
             {
                 String origValue = orig.get(key);
-                if (origValue == null || !origValue.equals(value))
+                if (origValue == null || !origValue.equals(value)) {
                     Main.pref.put(key, value);
+                }
                 orig.remove(key); // processed.
             }
         }
-        for (Entry<String, String> e : orig.entrySet())
+        for (Entry<String, String> e : orig.entrySet()) {
             Main.pref.put(e.getKey(), null);
+        }
         return false;
     }
@@ -209,8 +219,21 @@
     private void editPreference(final PreferenceDialog gui, final JTable list) {
         if (list.getSelectedRowCount() != 1) {
-            JOptionPane.showMessageDialog(gui, tr("Please select the row to edit."));
+            OptionPaneUtil.showMessageDialog(
+                    gui,
+                    tr("Please select the row to edit."),
+                    tr("Warning"),
+                    JOptionPane.WARNING_MESSAGE
+            );
             return;
         }
-        String v = JOptionPane.showInputDialog(tr("New value for {0}", model.getValueAt(list.getSelectedRow(), 0)), model.getValueAt(list.getSelectedRow(), 1));
+        String v = (String) OptionPaneUtil.showInputDialog(
+                Main.parent,
+                tr("New value for {0}", model.getValueAt(list.getSelectedRow(), 0)),
+                tr("New value"),
+                JOptionPane.QUESTION_MESSAGE,
+                null,
+                null,
+                model.getValueAt(list.getSelectedRow(), 1)
+        );
         if (v != null) {
             data.put((String) model.getValueAt(list.getSelectedRow(), 0), v);
@@ -221,5 +244,10 @@
     private void removePreference(final PreferenceDialog gui, final JTable list) {
         if (list.getSelectedRowCount() == 0) {
-            JOptionPane.showMessageDialog(gui, tr("Please select the row to delete."));
+            OptionPaneUtil.showMessageDialog(
+                    gui,
+                    tr("Please select the row to delete."),
+                    tr("Warning"),
+                    JOptionPane.WARNING_MESSAGE
+            );
             return;
         }
@@ -238,5 +266,10 @@
         p.add(new JLabel(tr("Value")), GBC.std().insets(0,0,5,0));
         p.add(value, GBC.eol().insets(5,0,0,0).fill(GBC.HORIZONTAL));
-        int answer = JOptionPane.showConfirmDialog(gui, p, tr("Enter a new key/value pair"), JOptionPane.OK_CANCEL_OPTION);
+        int answer = OptionPaneUtil.showConfirmationDialog(
+                gui, p,
+                tr("Enter a new key/value pair"),
+                JOptionPane.OK_CANCEL_OPTION,
+                JOptionPane.PLAIN_MESSAGE
+        );
         if (answer == JOptionPane.OK_OPTION) {
             data.put(key.getText(), value.getText());
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java	(revision 1865)
@@ -36,4 +36,5 @@
 import org.openstreetmap.josm.data.osm.visitor.MapPaintVisitor;
 import org.openstreetmap.josm.gui.MapScaler;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.gui.dialogs.ConflictDialog;
 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
@@ -81,10 +82,11 @@
         Map<String, String> colorKeyList_layer = new TreeMap<String, String>();
         for(String key : colorMap.keySet()) {
-            if(key.startsWith("layer "))
+            if(key.startsWith("layer ")) {
                 colorKeyList_layer.put(getName(key), key);
-            else if(key.startsWith("mappaint."))
+            } else if(key.startsWith("mappaint.")) {
                 colorKeyList_mappaint.put(getName(key), key);
-            else
+            } else {
                 colorKeyList.put(getName(key), key);
+            }
         }
         for (Entry<String, String> k : colorKeyList.entrySet()) {
@@ -155,9 +157,12 @@
                 int sel = colors.getSelectedRow();
                 JColorChooser chooser = new JColorChooser((Color)colors.getValueAt(sel, 1));
-                int answer = JOptionPane.showConfirmDialog(gui, chooser,
-                tr("Choose a color for {0}", getName((String)colors.getValueAt(sel, 0))),
-                JOptionPane.OK_CANCEL_OPTION);
-                if (answer == JOptionPane.OK_OPTION)
+                int answer = OptionPaneUtil.showConfirmationDialog(
+                        gui, chooser,
+                        tr("Choose a color for {0}", getName((String)colors.getValueAt(sel, 0))),
+                        JOptionPane.OK_CANCEL_OPTION,
+                        JOptionPane.PLAIN_MESSAGE);
+                if (answer == JOptionPane.OK_OPTION) {
                     colors.setValueAt(chooser.getColor(), sel, 1);
+                }
             }
         });
@@ -168,6 +173,7 @@
                 String name = (String)colors.getValueAt(sel, 0);
                 Color c = Main.pref.getDefaultColor(name);
-                if (c != null)
+                if (c != null) {
                     colors.setValueAt(c, sel, 1);
+                }
             }
         });
@@ -177,8 +183,9 @@
                 for(int i = 0; i < colors.getRowCount(); ++i)
                 {
-                  String name = (String)colors.getValueAt(i, 0);
-                  Color c = Main.pref.getDefaultColor(name);
-                  if (c != null)
-                      colors.setValueAt(c, i, 1);
+                    String name = (String)colors.getValueAt(i, 0);
+                    Color c = Main.pref.getDefaultColor(name);
+                    if (c != null) {
+                        colors.setValueAt(c, i, 1);
+                    }
                 }
             }
@@ -257,12 +264,14 @@
     public boolean ok() {
         Boolean ret = false;
-        for(String d : del)
+        for(String d : del) {
             Main.pref.put("color."+d, null);
+        }
         for (int i = 0; i < colors.getRowCount(); ++i) {
             String key = (String)colors.getValueAt(i, 0);
             if(Main.pref.putColor(key, (Color)colors.getValueAt(i, 1)))
             {
-                if(key.startsWith("mappaint."))
+                if(key.startsWith("mappaint.")) {
                     ret = true;
+                }
             }
         }
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/PluginPreference.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/PluginPreference.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/PluginPreference.java	(revision 1865)
@@ -22,4 +22,6 @@
 import javax.swing.Scrollable;
 
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.plugins.PluginDownloader;
 import org.openstreetmap.josm.plugins.PluginSelection;
@@ -78,6 +80,7 @@
         p.add(new JLabel(tr("Add JOSM Plugin description URL.")), GBC.eol());
         final DefaultListModel model = new DefaultListModel();
-        for (String s : PluginDownloader.getSites())
+        for (String s : PluginDownloader.getSites()) {
             model.addElement(s);
+        }
         final JList list = new JList(model);
         p.add(new JScrollPane(list), GBC.std().fill());
@@ -85,7 +88,13 @@
         buttons.add(new JButton(new AbstractAction(tr("Add")){
             public void actionPerformed(ActionEvent e) {
-                String s = JOptionPane.showInputDialog(gui, tr("Add JOSM Plugin description URL."));
-                if (s != null)
+                String s = OptionPaneUtil.showInputDialog(
+                        gui,
+                        tr("Add JOSM Plugin description URL."),
+                        tr("Enter URL"),
+                        JOptionPane.QUESTION_MESSAGE
+                );
+                if (s != null) {
                     model.addElement(s);
+                }
             }
         }), GBC.eol().fill(GBC.HORIZONTAL));
@@ -93,8 +102,21 @@
             public void actionPerformed(ActionEvent e) {
                 if (list.getSelectedValue() == null) {
-                    JOptionPane.showMessageDialog(gui, tr("Please select an entry."));
+                    OptionPaneUtil.showMessageDialog(
+                            gui,
+                            tr("Please select an entry."),
+                            tr("Warning"),
+                            JOptionPane.WARNING_MESSAGE
+                    );
                     return;
                 }
-                String s = JOptionPane.showInputDialog(gui, tr("Edit JOSM Plugin description URL."), list.getSelectedValue());
+                String s = (String)OptionPaneUtil.showInputDialog(
+                        Main.parent,
+                        tr("Edit JOSM Plugin description URL."),
+                        tr("JOSM Plugin description URL"),
+                        JOptionPane.QUESTION_MESSAGE,
+                        null,
+                        null,
+                        list.getSelectedValue()
+                );
                 model.setElementAt(s, list.getSelectedIndex());
             }
@@ -103,5 +125,10 @@
             public void actionPerformed(ActionEvent event) {
                 if (list.getSelectedValue() == null) {
-                    JOptionPane.showMessageDialog(gui, tr("Please select an entry."));
+                    OptionPaneUtil.showMessageDialog(
+                            gui,
+                            tr("Please select an entry."),
+                            tr("Warning"),
+                            JOptionPane.WARNING_MESSAGE
+                    );
                     return;
                 }
@@ -110,10 +137,15 @@
         }), GBC.eol().fill(GBC.HORIZONTAL));
         p.add(buttons, GBC.eol());
-        int answer = JOptionPane.showConfirmDialog(gui, p, tr("Configure Plugin Sites"), JOptionPane.OK_CANCEL_OPTION);
+        int answer = OptionPaneUtil.showConfirmationDialog(
+                gui,
+                p,
+                tr("Configure Plugin Sites"), JOptionPane.OK_CANCEL_OPTION,
+                JOptionPane.PLAIN_MESSAGE);
         if (answer != JOptionPane.OK_OPTION)
             return;
         Collection<String> sites = new LinkedList<String>();
-        for (int i = 0; i < model.getSize(); ++i)
+        for (int i = 0; i < model.getSize(); ++i) {
             sites.add((String)model.getElementAt(i));
+        }
         PluginDownloader.setSites(sites);
     }
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java	(revision 1865)
@@ -22,4 +22,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.plugins.PluginHandler;
 import org.openstreetmap.josm.tools.BugReportExceptionHandler;
@@ -95,9 +96,16 @@
         for (PreferenceSetting setting : settings)
         {
-            if(setting.ok())
+            if(setting.ok()) {
                 requiresRestart = true;
+            }
         }
-        if (requiresRestart)
-            JOptionPane.showMessageDialog(Main.parent,tr("You have to restart JOSM for some settings to take effect."));
+        if (requiresRestart) {
+            OptionPaneUtil.showMessageDialog(
+                    Main.parent,
+                    tr("You have to restart JOSM for some settings to take effect."),
+                    tr("Warning"),
+                    JOptionPane.WARNING_MESSAGE
+            );
+        }
         Main.parent.repaint();
     }
@@ -139,7 +147,6 @@
     public <T>  T getSetting(Class<? extends T> clazz) {
         for (PreferenceSetting setting:settings) {
-            if (clazz.isAssignableFrom(setting.getClass())) {
+            if (clazz.isAssignableFrom(setting.getClass()))
                 return (T)setting;
-            }
         }
         return null;
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/StyleSources.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/StyleSources.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/StyleSources.java	(revision 1865)
@@ -30,4 +30,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.io.MirroredInputStream;
 import org.openstreetmap.josm.tools.GBC;
@@ -62,10 +63,19 @@
         {
             String s = tr("Short Description: {0}", getName()) + "<br>" + tr("URL: {0}", url);
-            if(author != null) s += "<br>" + tr("Author: {0}", author);
-            if(link != null) s += "<br>" + tr("Webpage: {0}", link);
-            if(description != null) s += "<br>" + tr("Description: {0}", description);
-            if(version != null) s += "<br>" + tr("Version: {0}", version);
+            if(author != null) {
+                s += "<br>" + tr("Author: {0}", author);
+            }
+            if(link != null) {
+                s += "<br>" + tr("Webpage: {0}", link);
+            }
+            if(description != null) {
+                s += "<br>" + tr("Description: {0}", description);
+            }
+            if(version != null) {
+                s += "<br>" + tr("Version: {0}", version);
+            }
             return "<html>" + s + "</html>";
         }
+        @Override
         public String toString()
         {
@@ -76,5 +86,5 @@
     class MyCellRenderer extends JLabel implements ListCellRenderer {
         public Component getListCellRendererComponent(JList list, Object value,
-        int index, boolean isSelected, boolean cellHasFocus)
+                int index, boolean isSelected, boolean cellHasFocus)
         {
             String s = value.toString();
@@ -107,7 +117,9 @@
 
         Collection<String> sources = Main.pref.getCollection(pref, null);
-        if(sources != null)
-            for(String s : sources)
+        if(sources != null) {
+            for(String s : sources) {
                 ((DefaultListModel)sourcesList.getModel()).addElement(s);
+            }
+        }
 
         JButton iconadd = null;
@@ -119,14 +131,22 @@
             iconsList = new JList(new DefaultListModel());
             sources = Main.pref.getCollection(iconpref, null);
-            if(sources != null)
-                for(String s : sources)
+            if(sources != null) {
+                for(String s : sources) {
                     ((DefaultListModel)iconsList.getModel()).addElement(s);
+                }
+            }
 
             iconadd = new JButton(tr("Add"));
             iconadd.addActionListener(new ActionListener(){
                 public void actionPerformed(ActionEvent e) {
-                    String source = JOptionPane.showInputDialog(Main.parent, tr("Icon paths"));
-                    if (source != null)
+                    String source = OptionPaneUtil.showInputDialog(
+                            Main.parent,
+                            tr("Icon paths"),
+                            tr("Icon paths"),
+                            JOptionPane.QUESTION_MESSAGE
+                    );
+                    if (source != null) {
                         ((DefaultListModel)iconsList.getModel()).addElement(source);
+                    }
                 }
             });
@@ -135,11 +155,24 @@
             iconedit.addActionListener(new ActionListener(){
                 public void actionPerformed(ActionEvent e) {
-                    if (sourcesList.getSelectedIndex() == -1)
-                        JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to edit."));
-                    else {
-                        String source = JOptionPane.showInputDialog(Main.parent,
-                        tr("Icon paths"), iconsList.getSelectedValue());
-                        if (source != null)
+                    if (sourcesList.getSelectedIndex() == -1) {
+                        OptionPaneUtil.showMessageDialog(
+                                Main.parent,
+                                tr("Please select the row to edit."),
+                                tr("Warning"),
+                                JOptionPane.WARNING_MESSAGE
+                        );
+                    } else {
+                        String source = (String)OptionPaneUtil.showInputDialog(
+                                Main.parent,
+                                tr("Icon paths"),
+                                tr("Icon paths"),
+                                JOptionPane.QUESTION_MESSAGE,
+                                null,
+                                null,
+                                iconsList.getSelectedValue()
+                        );
+                        if (source != null) {
                             ((DefaultListModel)iconsList.getModel()).setElementAt(source, iconsList.getSelectedIndex());
+                        }
                     }
                 }
@@ -149,7 +182,10 @@
             icondelete.addActionListener(new ActionListener(){
                 public void actionPerformed(ActionEvent e) {
-                    if (iconsList.getSelectedIndex() == -1)
-                        JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete."));
-                    else {
+                    if (iconsList.getSelectedIndex() == -1) {
+                        OptionPaneUtil.showMessageDialog(
+                                Main.parent, tr("Please select the row to delete."),
+                                tr("Warning"),
+                                JOptionPane.WARNING_MESSAGE);
+                    } else {
                         ((DefaultListModel)iconsList.getModel()).remove(iconsList.getSelectedIndex());
                     }
@@ -161,7 +197,12 @@
         add.addActionListener(new ActionListener(){
             public void actionPerformed(ActionEvent e) {
-                String source = JOptionPane.showInputDialog(Main.parent, name);
-                if (source != null)
+                String source = OptionPaneUtil.showInputDialog(
+                        Main.parent,
+                        name,
+                        name,
+                        JOptionPane.QUESTION_MESSAGE);
+                if (source != null) {
                     ((DefaultListModel)sourcesList.getModel()).addElement(source);
+                }
             }
         });
@@ -170,11 +211,21 @@
         edit.addActionListener(new ActionListener(){
             public void actionPerformed(ActionEvent e) {
-                if (sourcesList.getSelectedIndex() == -1)
-                    JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to edit."));
-                else {
-                    String source = JOptionPane.showInputDialog(Main.parent,
-                    name, sourcesList.getSelectedValue());
-                    if (source != null)
+                if (sourcesList.getSelectedIndex() == -1) {
+                    OptionPaneUtil.showMessageDialog(
+                            Main.parent, tr("Please select the row to edit."),
+                            tr("Warning"), JOptionPane.WARNING_MESSAGE);
+                } else {
+                    String source = (String)OptionPaneUtil.showInputDialog(
+                            Main.parent,
+                            name,
+                            name,
+                            JOptionPane.QUESTION_MESSAGE,
+                            null,
+                            null,
+                            sourcesList.getSelectedValue()
+                    );
+                    if (source != null) {
                         ((DefaultListModel)sourcesList.getModel()).setElementAt(source, sourcesList.getSelectedIndex());
+                    }
                 }
             }
@@ -184,7 +235,8 @@
         delete.addActionListener(new ActionListener(){
             public void actionPerformed(ActionEvent e) {
-                if (sourcesList.getSelectedIndex() == -1)
-                    JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete."));
-                else {
+                if (sourcesList.getSelectedIndex() == -1) {
+                    OptionPaneUtil.showMessageDialog(Main.parent, tr("Please select the row to delete."),
+                            tr("Warning"), JOptionPane.WARNING_MESSAGE);
+                } else {
                     ((DefaultListModel)sourcesList.getModel()).remove(sourcesList.getSelectedIndex());
                 }
@@ -195,9 +247,11 @@
         copy.addActionListener(new ActionListener(){
             public void actionPerformed(ActionEvent e) {
-                if (sourcesDefaults.getSelectedIndex() == -1)
-                    JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to copy."));
-                else {
+                if (sourcesDefaults.getSelectedIndex() == -1) {
+                    OptionPaneUtil.showMessageDialog(
+                            Main.parent, tr("Please select the row to copy."),
+                            tr("Warning"), JOptionPane.WARNING_MESSAGE);
+                } else {
                     ((DefaultListModel)sourcesList.getModel()).addElement(
-                    ((SourceInfo)sourcesDefaults.getSelectedValue()).url);
+                            ((SourceInfo)sourcesDefaults.getSelectedValue()).url);
                 }
             }
@@ -213,6 +267,7 @@
                 {
                     ArrayList<String> l = new ArrayList<String>();
-                    for (int i = 0; i < num; ++i)
+                    for (int i = 0; i < num; ++i) {
                         MirroredInputStream.cleanup((String)sourcesList.getModel().getElementAt(i));
+                    }
                 }
             }
@@ -256,11 +311,14 @@
         {
             ArrayList<String> l = new ArrayList<String>();
-            for (int i = 0; i < num; ++i)
+            for (int i = 0; i < num; ++i) {
                 l.add((String)sourcesList.getModel().getElementAt(i));
-            if(Main.pref.putCollection(pref, l))
+            }
+            if(Main.pref.putCollection(pref, l)) {
                 changed = true;
-        }
-        else if(Main.pref.putCollection(pref, null))
+            }
+        }
+        else if(Main.pref.putCollection(pref, null)) {
             changed = true;
+        }
         if(iconsList != null)
         {
@@ -269,11 +327,14 @@
             {
                 ArrayList<String> l = new ArrayList<String>();
-                for (int i = 0; i < num; ++i)
+                for (int i = 0; i < num; ++i) {
                     l.add((String)iconsList.getModel().getElementAt(i));
-                if(Main.pref.putCollection(iconpref, l))
+                }
+                if(Main.pref.putCollection(iconpref, l)) {
                     changed = true;
-            }
-            else if(Main.pref.putCollection(iconpref, null))
+                }
+            }
+            else if(Main.pref.putCollection(iconpref, null)) {
                 changed = true;
+            }
         }
         return changed;
@@ -313,22 +374,23 @@
                             String key = m.group(1);
                             String value = m.group(2);
-                            if("author".equals(key) && last.author == null)
+                            if("author".equals(key) && last.author == null) {
                                 last.author = value;
-                            else if("version".equals(key))
+                            } else if("version".equals(key)) {
                                 last.version = value;
-                            else if("link".equals(key) && last.link == null)
+                            } else if("link".equals(key) && last.link == null) {
                                 last.link = value;
-                            else if("description".equals(key) && last.description == null)
+                            } else if("description".equals(key) && last.description == null) {
                                 last.description = value;
-                            else if("shortdescription".equals(key) && last.shortdescription == null)
+                            } else if("shortdescription".equals(key) && last.shortdescription == null) {
                                 last.shortdescription = value;
-                            else if((lang+"author").equals(key))
+                            } else if((lang+"author").equals(key)) {
                                 last.author = value;
-                            else if((lang+"link").equals(key))
+                            } else if((lang+"link").equals(key)) {
                                 last.link = value;
-                            else if((lang+"description").equals(key))
+                            } else if((lang+"description").equals(key)) {
                                 last.description = value;
-                            else if((lang+"shortdescription").equals(key))
+                            } else if((lang+"shortdescription").equals(key)) {
                                 last.shortdescription = value;
+                            }
                         }
                     }
Index: /trunk/src/org/openstreetmap/josm/gui/progress/PleaseWaitProgressMonitor.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/progress/PleaseWaitProgressMonitor.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/progress/PleaseWaitProgressMonitor.java	(revision 1865)
@@ -16,5 +16,7 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.gui.PleaseWaitDialog;
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 
@@ -73,4 +75,5 @@
     }
 
+    @Override
     public void doBeginTask() {
         doInEDT(new Runnable() {
@@ -80,7 +83,6 @@
                 } else if (dialogParent instanceof Dialog) {
                     dialog = new PleaseWaitDialog((Dialog)dialogParent);
-                } else {
+                } else
                     throw new ProgressException("PleaseWaitDialog parent must be either Frame or Dialog");
-                }
 
                 dialog.cancel.setEnabled(true);
@@ -94,4 +96,5 @@
     }
 
+    @Override
     public void doFinishTask() {
         doInEDT(new Runnable() {
@@ -103,5 +106,8 @@
                     dialog.cancel.removeActionListener(cancelListener);
                     if (getErrorMessage() != null) {
-                        JOptionPane.showMessageDialog(Main.parent, getErrorMessage());
+                        OptionPaneUtil.showMessageDialog(
+                                Main.parent, getErrorMessage(),
+                                tr("Error"),
+                                JOptionPane.ERROR_MESSAGE);
                     }
                     dialog = null;
@@ -111,4 +117,5 @@
     }
 
+    @Override
     protected void updateProgress(double progressValue) {
         final int newValue = (int)(progressValue * PROGRESS_BAR_MAX);
Index: /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 1865)
@@ -44,4 +44,5 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.ExtendedDialog;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.gui.QuadStateCheckBox;
 import org.openstreetmap.josm.io.MirroredInputStream;
@@ -598,8 +599,18 @@
             } catch (IOException e) {
                 e.printStackTrace();
-                JOptionPane.showMessageDialog(Main.parent, tr("Could not read tagging preset source: {0}",source));
+                OptionPaneUtil.showMessageDialog(
+                        Main.parent,
+                        tr("Could not read tagging preset source: {0}",source),
+                        tr("Error"),
+                        JOptionPane.ERROR_MESSAGE
+                );
             } catch (SAXException e) {
                 e.printStackTrace();
-                JOptionPane.showMessageDialog(Main.parent, tr("Error parsing {0}: ", source)+e.getMessage());
+                OptionPaneUtil.showMessageDialog(
+                        Main.parent,
+                        tr("Error parsing {0}: ", source)+e.getMessage(),
+                        tr("Error"),
+                        JOptionPane.ERROR_MESSAGE
+                );
             }
         }
Index: /trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java	(revision 1865)
@@ -15,4 +15,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 
 /**
@@ -68,5 +69,6 @@
             interrupt();
             while (result == Result.WAITING) { sleep(10); /* yield(); */ }
-            if (result == Result.FAILED) { throw exception; }
+            if (result == Result.FAILED)
+                throw exception;
         }
         private void possiblyInterrupt() throws InterruptedException {
@@ -229,33 +231,33 @@
             try {
                 switch (state) {
-                case INITIALIZING:
-                    // we're ready to take interrupts
-                    state = State.NOTPLAYING;
-                    break;
-                case NOTPLAYING:
-                case PAUSED:
-                    sleep(200);
-                    break;
-                case PLAYING:
-                    command.possiblyInterrupt();
-                    for(;;) {
-                        int nBytesRead = 0;
-                        nBytesRead = audioInputStream.read(abData, 0, abData.length);
-                        position += nBytesRead / bytesPerSecond;
+                    case INITIALIZING:
+                        // we're ready to take interrupts
+                        state = State.NOTPLAYING;
+                        break;
+                    case NOTPLAYING:
+                    case PAUSED:
+                        sleep(200);
+                        break;
+                    case PLAYING:
                         command.possiblyInterrupt();
-                        if (nBytesRead < 0) { break; }
-                        audioOutputLine.write(abData, 0, nBytesRead); // => int nBytesWritten
+                        for(;;) {
+                            int nBytesRead = 0;
+                            nBytesRead = audioInputStream.read(abData, 0, abData.length);
+                            position += nBytesRead / bytesPerSecond;
+                            command.possiblyInterrupt();
+                            if (nBytesRead < 0) { break; }
+                            audioOutputLine.write(abData, 0, nBytesRead); // => int nBytesWritten
+                            command.possiblyInterrupt();
+                        }
+                        // end of audio, clean up
+                        audioOutputLine.drain();
+                        audioOutputLine.close();
+                        audioOutputLine = null;
+                        audioInputStream.close();
+                        audioInputStream = null;
+                        playingUrl = null;
+                        state = State.NOTPLAYING;
                         command.possiblyInterrupt();
-                    }
-                    // end of audio, clean up
-                    audioOutputLine.drain();
-                    audioOutputLine.close();
-                    audioOutputLine = null;
-                    audioInputStream.close();
-                    audioInputStream = null;
-                    playingUrl = null;
-                    state = State.NOTPLAYING;
-                    command.possiblyInterrupt();
-                    break;
+                        break;
                 }
             } catch (InterruptedException e) {
@@ -265,46 +267,49 @@
                 try {
                     switch (command.command()) {
-                    case PLAY:
-                        double offset = command.offset();
-                        speed = command.speed();
-                        if (playingUrl != command.url() ||
-                            stateChange != State.PAUSED ||
-                            offset != 0.0)
-                        {
-                            if (audioInputStream != null) {
-                                audioInputStream.close();
-                                audioInputStream = null;
-                            }
-                            playingUrl = command.url();
-                            audioInputStream = AudioSystem.getAudioInputStream(playingUrl);
-                            audioFormat = audioInputStream.getFormat();
-                            long nBytesRead = 0;
-                            position = 0.0;
-                            offset -= leadIn;
-                            double calibratedOffset = offset * calibration;
-                            bytesPerSecond = audioFormat.getFrameRate() /* frames per second */
+                        case PLAY:
+                            double offset = command.offset();
+                            speed = command.speed();
+                            if (playingUrl != command.url() ||
+                                    stateChange != State.PAUSED ||
+                                    offset != 0.0)
+                            {
+                                if (audioInputStream != null) {
+                                    audioInputStream.close();
+                                    audioInputStream = null;
+                                }
+                                playingUrl = command.url();
+                                audioInputStream = AudioSystem.getAudioInputStream(playingUrl);
+                                audioFormat = audioInputStream.getFormat();
+                                long nBytesRead = 0;
+                                position = 0.0;
+                                offset -= leadIn;
+                                double calibratedOffset = offset * calibration;
+                                bytesPerSecond = audioFormat.getFrameRate() /* frames per second */
                                 * audioFormat.getFrameSize() /* bytes per frame */;
-                            if (speed * bytesPerSecond > 256000.0)
-                                speed = 256000 / bytesPerSecond;
-                            if (calibratedOffset > 0.0) {
-                                long bytesToSkip = (long)(
-                                        calibratedOffset /* seconds (double) */ * bytesPerSecond);
-                                /* skip doesn't seem to want to skip big chunks, so
-                                 * reduce it to smaller ones
-                                 */
-                                // audioInputStream.skip(bytesToSkip);
-                                while (bytesToSkip > chunk) {
-                                    nBytesRead = audioInputStream.skip(chunk);
-                                    if (nBytesRead <= 0)
-                                        throw new IOException(tr("This is after the end of the recording"));
-                                    bytesToSkip -= nBytesRead;
+                                if (speed * bytesPerSecond > 256000.0) {
+                                    speed = 256000 / bytesPerSecond;
                                 }
-                                if (bytesToSkip > 0)
-                                    audioInputStream.skip(bytesToSkip);
-                                position = offset;
-                            }
-                            if (audioOutputLine != null)
-                                audioOutputLine.close();
-                            audioFormat = new AudioFormat(audioFormat.getEncoding(),
+                                if (calibratedOffset > 0.0) {
+                                    long bytesToSkip = (long)(
+                                            calibratedOffset /* seconds (double) */ * bytesPerSecond);
+                                    /* skip doesn't seem to want to skip big chunks, so
+                                     * reduce it to smaller ones
+                                     */
+                                    // audioInputStream.skip(bytesToSkip);
+                                    while (bytesToSkip > chunk) {
+                                        nBytesRead = audioInputStream.skip(chunk);
+                                        if (nBytesRead <= 0)
+                                            throw new IOException(tr("This is after the end of the recording"));
+                                        bytesToSkip -= nBytesRead;
+                                    }
+                                    if (bytesToSkip > 0) {
+                                        audioInputStream.skip(bytesToSkip);
+                                    }
+                                    position = offset;
+                                }
+                                if (audioOutputLine != null) {
+                                    audioOutputLine.close();
+                                }
+                                audioFormat = new AudioFormat(audioFormat.getEncoding(),
                                         audioFormat.getSampleRate() * (float) (speed * calibration),
                                         audioFormat.getSampleSizeInBits(),
@@ -313,14 +318,14 @@
                                         audioFormat.getFrameRate() * (float) (speed * calibration),
                                         audioFormat.isBigEndian());
-                            DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);
-                            audioOutputLine = (SourceDataLine) AudioSystem.getLine(info);
-                            audioOutputLine.open(audioFormat);
-                            audioOutputLine.start();
-                        }
-                        stateChange = State.PLAYING;
-                        break;
-                    case PAUSE:
-                        stateChange = State.PAUSED;
-                        break;
+                                DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);
+                                audioOutputLine = (SourceDataLine) AudioSystem.getLine(info);
+                                audioOutputLine.open(audioFormat);
+                                audioOutputLine.start();
+                            }
+                            stateChange = State.PLAYING;
+                            break;
+                        case PAUSE:
+                            stateChange = State.PAUSED;
+                            break;
                     }
                     command.ok(stateChange);
@@ -335,5 +340,5 @@
 
     public static void audioMalfunction(Exception ex) {
-        JOptionPane.showMessageDialog(Main.parent,
+        OptionPaneUtil.showMessageDialog(Main.parent,
                 "<html><p>" + tr(ex.getMessage()) + "</p></html>",
                 tr("Error playing sound"), JOptionPane.ERROR_MESSAGE);
Index: /trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java	(revision 1865)
@@ -20,6 +20,6 @@
 
 import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.actions.AboutAction;
 import org.openstreetmap.josm.actions.ShowStatusReportAction;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.plugins.PluginHandler;
 
@@ -39,8 +39,11 @@
             if (e instanceof OutOfMemoryError) {
                 // do not translate the string, as translation may raise an exception
-                JOptionPane.showMessageDialog(Main.parent, "JOSM is out of memory. " +
+                OptionPaneUtil.showMessageDialog(Main.parent, "JOSM is out of memory. " +
                         "Strange things may happen.\nPlease restart JOSM with the -Xmx###M option,\n" +
                         "where ### is the the number of MB assigned to JOSM (e.g. 256).\n" +
-                        "Currently, " + Runtime.getRuntime().maxMemory()/1024/1024 + " MB are available to JOSM.");
+                        "Currently, " + Runtime.getRuntime().maxMemory()/1024/1024 + " MB are available to JOSM.",
+                        tr("Error"),
+                        JOptionPane.ERROR_MESSAGE
+                );
                 return;
             }
@@ -50,10 +53,10 @@
 
             Object[] options = new String[]{tr("Do nothing"), tr("Report Bug")};
-            int answer = JOptionPane.showOptionDialog(Main.parent, tr("An unexpected exception occurred.\n\n" +
-            "This is always a coding error. If you are running the latest\n" +
+            int answer = OptionPaneUtil.showOptionDialog(Main.parent, tr("An unexpected exception occurred.\n\n" +
+                    "This is always a coding error. If you are running the latest\n" +
             "version of JOSM, please consider being kind and file a bug report."),
             tr("Unexpected Exception"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE,
-            null, options, options[0]);
-            if (answer == 1) {
+            options, options[0]);
+            if (answer == JOptionPane.YES_OPTION) {
                 try {
                     StringWriter stack = new StringWriter();
@@ -65,7 +68,7 @@
                     JPanel p = new JPanel(new GridBagLayout());
                     p.add(new JLabel("<html>" + tr("Please report a ticket at {0}","http://josm.openstreetmap.de/newticket") +
-                    "<br>" + tr("Include your steps to get to the error (as detailed as possible)!") +
-                    "<br>" + tr("Try updating to the newest version of JOSM and all plugins before reporting a bug.") +
-                    "<br>" + tr("Be sure to include the following information:") + "</html>"), GBC.eol());
+                            "<br>" + tr("Include your steps to get to the error (as detailed as possible)!") +
+                            "<br>" + tr("Try updating to the newest version of JOSM and all plugins before reporting a bug.") +
+                            "<br>" + tr("Be sure to include the following information:") + "</html>"), GBC.eol());
                     try {
                         Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(text), new ClipboardOwner(){
@@ -81,5 +84,5 @@
                     p.add(new JScrollPane(info), GBC.eop());
 
-                    JOptionPane.showMessageDialog(Main.parent, p);
+                    OptionPaneUtil.showMessageDialog(Main.parent, p, tr("Warning"), JOptionPane.WARNING_MESSAGE);
                 } catch (Exception e1) {
                     e1.printStackTrace();
Index: /trunk/src/org/openstreetmap/josm/tools/Shortcut.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/Shortcut.java	(revision 1864)
+++ /trunk/src/org/openstreetmap/josm/tools/Shortcut.java	(revision 1865)
@@ -4,4 +4,5 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 
 import java.awt.event.KeyEvent;
@@ -30,7 +31,7 @@
  */
 public class Shortcut {
-//  public static final int SHIFT = KeyEvent.SHIFT_DOWN_MASK;
-//  public static final int CTRL = KeyEvent.CTRL_DOWN_MASK;
-//  public static final int SHIFT_CTRL = KeyEvent.SHIFT_DOWN_MASK|KeyEvent.CTRL_DOWN_MASK;
+    //  public static final int SHIFT = KeyEvent.SHIFT_DOWN_MASK;
+    //  public static final int CTRL = KeyEvent.CTRL_DOWN_MASK;
+    //  public static final int SHIFT_CTRL = KeyEvent.SHIFT_DOWN_MASK|KeyEvent.CTRL_DOWN_MASK;
     public static final int SHIFT_DEFAULT = 1;
     private String shortText;        // the unique ID of the shortcut
@@ -135,5 +136,7 @@
     public void setAssignedUser(boolean assignedUser) {
         this.reset = (!this.assignedUser && assignedUser);
-        if (assignedUser) assignedDefault = false;
+        if (assignedUser) {
+            assignedDefault = false;
+        }
         this.assignedUser = assignedUser;
     }
@@ -215,11 +218,9 @@
     // check if something collides with an existing shortcut
     private static Shortcut findShortcut(int requestedKey, int modifier) {
-        if (modifier == groups.get(GROUP_NONE)) {
+        if (modifier == groups.get(GROUP_NONE))
             return null;
-        }
         for (Shortcut sc : shortcuts.values()) {
-            if (sc.isSame(requestedKey, modifier)) {
+            if (sc.isSame(requestedKey, modifier))
                 return sc;
-            }
         }
         return null;
@@ -238,7 +239,6 @@
         for (int m : mods) {
             for (int k = KeyEvent.VK_A; k < KeyEvent.VK_Z; k++) { // we'll limit ourself to 100% safe keys
-                if ( findShortcut(k, m) == null ) {
+                if ( findShortcut(k, m) == null )
                     return new Shortcut(shortText, longText, requestedKey, requestedGroup, k, m, false, false);
-                }
             }
         }
@@ -281,5 +281,7 @@
         while (p != null) {
             Shortcut sc = new Shortcut(p);
-            if (sc.getAssignedUser()) registerShortcut(sc);
+            if (sc.getAssignedUser()) {
+                registerShortcut(sc);
+            }
             i++;
             p = Main.pref.get("shortcut.shortcut."+i, null);
@@ -290,5 +292,7 @@
         while (p != null) {
             Shortcut sc = new Shortcut(p);
-            if (!sc.getAssignedUser() && sc.getAssignedDefault()) registerShortcut(sc);
+            if (!sc.getAssignedUser() && sc.getAssignedDefault()) {
+                registerShortcut(sc);
+            }
             i++;
             p = Main.pref.get("shortcut.shortcut."+i, null);
@@ -299,5 +303,7 @@
         while (p != null) {
             Shortcut sc = new Shortcut(p);
-            if (!sc.getAssignedUser() && !sc.getAssignedDefault()) registerShortcut(sc);
+            if (!sc.getAssignedUser() && !sc.getAssignedDefault()) {
+                registerShortcut(sc);
+            }
             i++;
             p = Main.pref.get("shortcut.shortcut."+i, null);
@@ -307,11 +313,11 @@
     // shutdown handling
     public static void savePrefs() {
-//      we save this directly from the preferences pane, so don't overwrite these values here
-//      for (int i = GROUP_NONE; i < GROUP__MAX+GROUPS_ALT2; i++) {
-//      Main.pref.put("shortcut.groups."+i, Groups.get(i).toString());
-//      }
+        //      we save this directly from the preferences pane, so don't overwrite these values here
+        //      for (int i = GROUP_NONE; i < GROUP__MAX+GROUPS_ALT2; i++) {
+        //      Main.pref.put("shortcut.groups."+i, Groups.get(i).toString());
+        //      }
         int i = 0;
         for (Shortcut sc : shortcuts.values()) {
-//          TODO: Remove sc.getAssignedUser() when we fixed all internal conflicts
+            //          TODO: Remove sc.getAssignedUser() when we fixed all internal conflicts
             if (!sc.getAutomatic() && !sc.getReset() && sc.getAssignedUser()) {
                 Main.pref.put("shortcut.shortcut."+i, sc.asPrefString());
@@ -326,9 +332,10 @@
         // put a user configured shortcut in as-is -- unless there's a conflict
         if(sc.getAssignedUser() && findShortcut(sc.getAssignedKey(),
-        sc.getAssignedModifier()) == null)
+                sc.getAssignedModifier()) == null) {
             shortcuts.put(sc.getShortText(), sc);
-        else
+        } else {
             registerShortcut(sc.getShortText(), sc.getLongText(), sc.getRequestedKey(),
-            sc.getRequestedGroup(), sc.getAssignedModifier(), sc);
+                    sc.getRequestedGroup(), sc.getAssignedModifier(), sc);
+        }
     }
 
@@ -339,7 +346,6 @@
      */
     public static Shortcut registerSystemShortcut(String shortText, String longText, int key, int modifier) {
-        if (shortcuts.containsKey(shortText)) {
+        if (shortcuts.containsKey(shortText))
             return shortcuts.get(shortText);
-        }
         Shortcut potentialShortcut = findShortcut(key, modifier);
         if (potentialShortcut != null) {
@@ -391,8 +397,9 @@
         Integer defaultModifier = groups.get(requestedGroup + GROUPS_DEFAULT);
         if(modifier != null) {
-            if(modifier == SHIFT_DEFAULT)
+            if(modifier == SHIFT_DEFAULT) {
                 defaultModifier |= KeyEvent.SHIFT_DOWN_MASK;
-            else
+            } else {
                 defaultModifier = modifier;
+            }
         }
         else if (defaultModifier == null) { // garbage in, no shortcut out
@@ -437,5 +444,5 @@
     // a lengthy warning message
     private static void displayWarning(Shortcut conflictsWith, Shortcut potentialShortcut, String shortText, String longText) {
-        JOptionPane.showMessageDialog(Main.parent,
+        OptionPaneUtil.showMessageDialog(Main.parent,
                 tr("Setting the keyboard shortcut ''{0}'' for the action ''{1}'' ({2}) failed\n"+
                         "because the shortcut is already taken by the action ''{3}'' ({4}).\n\n",
@@ -447,5 +454,7 @@
                                     tr("Using the shortcut ''{0}'' instead.\n\n", potentialShortcut.getKeyText())
                         )+
-                        tr("(Hint: You can edit the shortcuts in the preferences.)")
+                        tr("(Hint: You can edit the shortcuts in the preferences.)"),
+                        tr("Error"),
+                        JOptionPane.ERROR_MESSAGE
         );
     }
