01: package org.swingml.icons;
02:
03: import java.net.*;
04:
05: import javax.swing.*;
06:
07: /**
08: * Utility class to fetch images (icons) stored locally.
09: *
10: * @author CrossLogic
11: */
12: public class IconLoader {
13:
14: public static final String ICON_PROGRESS_DIALOG = "progress.jpg";
15: public static final String ICON_PROGRESS_DIALOG_OVER = "progress-over.jpg";
16:
17: /**
18: * Locate and return an icon with the given filename.
19: *
20: * @param iconName
21: * @return
22: */
23: public static Icon getIcon(String iconName) {
24: Icon result = null;
25:
26: URL location = IconLoader.class.getResource(iconName);
27: if (location != null) {
28: result = new ImageIcon(location);
29: }
30:
31: return result;
32: }
33: }
|