Ignore:
Timestamp:
2011-12-26T21:48:25+01:00 (12 years ago)
Author:
simon04
Message:

see #7182 - Individual Icons for Imagery Background

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java

    r4531 r4713  
    55
    66import java.awt.event.ActionEvent;
    7 
     7import javax.swing.Action;
     8import javax.swing.ImageIcon;
    89import javax.swing.JOptionPane;
    9 
    1010import org.openstreetmap.josm.Main;
    1111import org.openstreetmap.josm.data.imagery.ImageryInfo;
    1212import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
    1313import org.openstreetmap.josm.gui.layer.ImageryLayer;
     14import org.openstreetmap.josm.tools.ImageRequest;
    1415
    1516public class AddImageryLayerAction extends JosmAction implements AdaptableAction {
    1617
     18    private static final int MAX_ICON_SIZE = 24;
    1719    private final ImageryInfo info;
    1820
     
    2224        this.info = info;
    2325        installAdapters();
     26
     27        // change toolbar icon from if specified
     28        try {
     29            if (info.getIcon() != null) {
     30                ImageIcon i = new ImageRequest().setName(info.getIcon()).setMaxHeight(MAX_ICON_SIZE).setMaxWidth(MAX_ICON_SIZE).get();
     31                putValue(Action.SMALL_ICON, i);
     32            }
     33        } catch (Exception ex) {
     34            throw new RuntimeException(ex.getMessage(), ex);
     35        }
    2436    }
    2537
Note: See TracChangeset for help on using the changeset viewer.