Index: trunk/src/org/openstreetmap/josm/gui/SideButton.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/SideButton.java	(revision 5006)
+++ trunk/src/org/openstreetmap/josm/gui/SideButton.java	(revision 5007)
@@ -4,9 +4,11 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
+import java.awt.BorderLayout;
 import java.awt.Color;
-import java.awt.BorderLayout;
 import java.awt.Image;
 import java.awt.Insets;
 import java.awt.event.ActionListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
 
 import javax.swing.Action;
@@ -23,8 +25,10 @@
 
 public class SideButton extends JButton {
+    private final static int iconHeight = 20;
+
     public SideButton(Action action)
     {
         super(action);
-        fixIcon();
+        fixIcon(action);
         doStyle();
     }
@@ -35,5 +39,5 @@
         if(!usename)
             setText(null);
-        fixIcon();
+        fixIcon(action);
         doStyle();
     }
@@ -46,16 +50,32 @@
     }
 
-    void fixIcon() {
+    void fixIcon(Action action) {
+        // need to listen for changes, so that putValue() that are called after the
+        // SideButton is constructed get the proper icon size
+        if(action != null) {
+            action.addPropertyChangeListener(new PropertyChangeListener() {
+                @Override
+                public void propertyChange(PropertyChangeEvent evt) {
+                    if(evt.getPropertyName() == javax.swing.Action.SMALL_ICON) {
+                        fixIcon(null);
+                    }
+                }
+            });
+        }
         Icon i = getIcon();
-        if(i != null && i instanceof ImageIcon)
-        {
-            Image im = ((ImageIcon) i).getImage();
-            setIcon(new ImageIcon(im.getScaledInstance(20, 20, Image.SCALE_SMOOTH)));
+        if(i != null && i instanceof ImageIcon && i.getIconHeight() != iconHeight) {
+            setIcon(getScaledImage(((ImageIcon) i).getImage()));
         }
+    }
+
+    /** scales the given image proportionally so that the height is "iconHeight" **/
+    private static ImageIcon getScaledImage(Image im) {
+        int newWidth = im.getWidth(null) *  iconHeight / im.getHeight(null);
+        return new ImageIcon(im.getScaledInstance(newWidth, iconHeight, Image.SCALE_SMOOTH));
     }
 
     public static ImageIcon makeIcon(String imagename) {
         Image im = ImageProvider.get("dialogs", imagename).getImage();
-        return new ImageIcon(im.getScaledInstance(20, 20, Image.SCALE_SMOOTH));
+        return getScaledImage(im);
     }
 
