1 package net.sf.openrocket.util;
4 import java.util.Collections;
5 import java.util.HashMap;
8 import javax.swing.Icon;
9 import javax.swing.ImageIcon;
11 import net.sf.openrocket.document.Simulation;
17 * Icons used for showing the status of a simulation (up to date, out of date, etc).
19 public static final Map<Simulation.Status, Icon> SIMULATION_STATUS_ICON_MAP;
21 HashMap<Simulation.Status, Icon> map = new HashMap<Simulation.Status, Icon>();
22 map.put(Simulation.Status.NOT_SIMULATED, loadImageIcon("pix/spheres/gray-16x16.png", "Not simulated"));
23 map.put(Simulation.Status.UPTODATE, loadImageIcon("pix/spheres/green-16x16.png", "Up to date"));
24 map.put(Simulation.Status.LOADED, loadImageIcon("pix/spheres/yellow-16x16.png", "Loaded from file"));
25 map.put(Simulation.Status.OUTDATED, loadImageIcon("pix/spheres/red-16x16.png", "Out-of-date"));
26 map.put(Simulation.Status.EXTERNAL, loadImageIcon("pix/spheres/blue-16x16.png", "Imported data"));
27 SIMULATION_STATUS_ICON_MAP = Collections.unmodifiableMap(map);
30 public static final Icon SIMULATION_LISTENER_OK;
31 public static final Icon SIMULATION_LISTENER_ERROR;
33 SIMULATION_LISTENER_OK = SIMULATION_STATUS_ICON_MAP.get(Simulation.Status.UPTODATE);
34 SIMULATION_LISTENER_ERROR = SIMULATION_STATUS_ICON_MAP.get(Simulation.Status.OUTDATED);
38 public static final Icon FILE_NEW = loadImageIcon("pix/icons/document-new.png", "New document");
39 public static final Icon FILE_OPEN = loadImageIcon("pix/icons/document-open.png", "Open document");
40 public static final Icon FILE_OPEN_EXAMPLE = loadImageIcon("pix/icons/document-open-example.png", "Open example document");
41 public static final Icon FILE_SAVE = loadImageIcon("pix/icons/document-save.png", "Save document");
42 public static final Icon FILE_SAVE_AS = loadImageIcon("pix/icons/document-save-as.png", "Save document as");
43 public static final Icon FILE_CLOSE = loadImageIcon("pix/icons/document-close.png", "Close document");
44 public static final Icon FILE_QUIT = loadImageIcon("pix/icons/application-exit.png", "Quit OpenRocket");
46 public static final Icon EDIT_UNDO = loadImageIcon("pix/icons/edit-undo.png", "Undo");
47 public static final Icon EDIT_REDO = loadImageIcon("pix/icons/edit-redo.png", "Redo");
48 public static final Icon EDIT_CUT = loadImageIcon("pix/icons/edit-cut.png", "Cut");
49 public static final Icon EDIT_COPY = loadImageIcon("pix/icons/edit-copy.png", "Copy");
50 public static final Icon EDIT_PASTE = loadImageIcon("pix/icons/edit-paste.png", "Paste");
51 public static final Icon EDIT_DELETE = loadImageIcon("pix/icons/edit-delete.png", "Delete");
53 public static final Icon ZOOM_IN = loadImageIcon("pix/icons/zoom-in.png", "Zoom in");
54 public static final Icon ZOOM_OUT = loadImageIcon("pix/icons/zoom-out.png", "Zoom out");
56 public static final Icon PREFERENCES = loadImageIcon("pix/icons/preferences.png", "Preferences");
58 public static final Icon DELETE = loadImageIcon("pix/icons/delete.png", "Delete");
62 public static ImageIcon loadImageIcon(String file, String name) {
63 URL url = ClassLoader.getSystemResource(file);
65 System.err.println("Resource "+file+" not found! Ignoring...");
68 return new ImageIcon(url, name);