Ignore:
Timestamp:
2007-02-14T16:21:14+01:00 (17 years ago)
Author:
imi
Message:
  • new MarkerLayer code from Frederik. Supports Audio, Image and WebMarker (links)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/tools/ImageProvider.java

    r159 r200  
    5252         */
    5353        public static ImageIcon get(String subdir, String name) {
    54                 if (subdir != "")
     54                ImageIcon icon = getIfAvailable(subdir, name);
     55                if (icon == null) {
     56                        String ext = name.indexOf('.') != -1 ? "" : ".png";
     57                        throw new NullPointerException("/images/"+subdir+name+ext+" not found");
     58                }
     59                return icon;
     60        }
     61
     62        /**
     63         * Like {@link #get(String)}, but does not throw and return <code>null</code>
     64         * in case of nothing is found. Use this, if the image to retrieve is optional.
     65         */
     66        public static ImageIcon getIfAvailable(String subdir, String name) {
     67                if (name == null)
     68                        return null;
     69                if (subdir == null || subdir != "")
    5570                        subdir += "/";
    5671                String ext = name.indexOf('.') != -1 ? "" : ".png";
Note: See TracChangeset for help on using the changeset viewer.