Changeset 200 in josm for src/org/openstreetmap/josm/tools/ImageProvider.java
- Timestamp:
- 2007-02-14T16:21:14+01:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/tools/ImageProvider.java
r159 r200 52 52 */ 53 53 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 != "") 55 70 subdir += "/"; 56 71 String ext = name.indexOf('.') != -1 ? "" : ".png";
Note:
See TracChangeset
for help on using the changeset viewer.