Changeset 2586 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2009-12-06T14:32:51+01:00 (15 years ago)
Author:
stoecker
Message:

fix regression - reduce image size in toggle windows

File:
1 edited

Legend:

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

    r2017 r2586  
    88
    99import javax.swing.Action;
     10import javax.swing.Icon;
    1011import javax.swing.ImageIcon;
    1112import javax.swing.JButton;
     
    1920    {
    2021        super(action);
     22        fixIcon();
    2123        doStyle();
    2224    }
     
    2426    public SideButton(Action action, String imagename)
    2527    {
    26         this(action);
     28        super(action);
    2729        setIcon(makeIcon(imagename));
     30        doStyle();
     31    }
     32
     33    void fixIcon() {
     34        Icon i = getIcon();
     35        if(i != null && i instanceof ImageIcon)
     36        {
     37            Image im = ((ImageIcon) i).getImage();
     38            setIcon(new ImageIcon(im.getScaledInstance(20 , 20, Image.SCALE_SMOOTH)));
     39        }
    2840    }
    2941
Note: See TracChangeset for help on using the changeset viewer.