Changeset 1227 in josm for trunk/src


Ignore:
Timestamp:
2009-01-09T21:44:01+01:00 (16 years ago)
Author:
ulfl
Message:

scale icons in the side panels down to 20*20 pixels to save screen space (is a bit blurred though)

File:
1 edited

Legend:

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

    r1180 r1227  
    44import java.awt.event.ActionListener;
    55import java.awt.Insets;
     6import java.awt.Image;
    67import javax.swing.Action;
    78import javax.swing.JButton;
     9import javax.swing.ImageIcon;
    810
    911import org.openstreetmap.josm.Main;
     
    1820        setText(null);
    1921    }
     22
     23    private static ImageIcon smallIcon(String imagename) {
     24        Image im = ImageProvider.get("dialogs", imagename).getImage();
     25        return new ImageIcon(im.getScaledInstance(20 , 20, Image.SCALE_SMOOTH));
     26    }
     27
    2028    public SideButton(String imagename, String property, String tooltip, ActionListener actionListener)
    2129    {
    22         super(ImageProvider.get("dialogs", imagename));
     30        super(smallIcon(imagename));
    2331        doStyle();
    2432        setActionCommand(imagename);
     
    2836    public SideButton(String name, String imagename, String property, String tooltip, Shortcut shortcut, ActionListener actionListener)
    2937    {
    30         super(tr(name), ImageProvider.get("dialogs", imagename));
     38        super(smallIcon(imagename));
    3139        if(shortcut != null)
    3240                {
     
    3947    public SideButton(String name, String imagename, String property, String tooltip, ActionListener actionListener)
    4048    {
    41         super(tr(name), ImageProvider.get("dialogs", imagename));
     49        super(smallIcon(imagename));
    4250        setup(name, property, tooltip, actionListener);
    4351    }
Note: See TracChangeset for help on using the changeset viewer.