1
2 package hep.wired.image;
3
4 import java.awt.Cursor;
5 import java.awt.Image;
6 import javax.swing.Icon;
7
8 import org.freehep.util.images.ImageHandler;
9
10 /***
11 * Facility class to load Images, Icons and Cursors.
12 *
13 * @author Mark Donszelmann
14 * @version $Id: WiredBaseImage.java 432 2004-08-30 22:31:50Z duns $
15 */
16 public class WiredBaseImage extends ImageHandler {
17
18
19 private WiredBaseImage() {
20 }
21
22 /***
23 * Returns an image for given name, relative to this class.
24 */
25 public static Image getImage(String name) {
26 return getImage(name, WiredBaseImage.class);
27 }
28
29 /***
30 * Returns the best cursor for given name, relative to this class. The cursor
31 * is created with given width and height.
32 */
33 public static Cursor getBestCursor(String name, int width, int height) {
34 return getBestCursor(name, width, height, 0, 0);
35 }
36
37 /***
38 * Returns the best cursor for given name, relative to this class. The cursor
39 * is created with given width and height and hotspot x, y.
40 */
41 public static Cursor getBestCursor(String name, int width, int height, int x, int y) {
42 return getBestCursor(name, WiredBaseImage.class, width, height, x, y);
43 }
44
45 /***
46 * Returns an icon for given name, relative to this class.
47 */
48 public static Icon getIcon(String name) {
49 return getIcon(name, WiredBaseImage.class);
50 }
51
52 /***
53 * Returns an icon for given name, relative to this class.
54 */
55 public static Icon getIcon(String name, int size) {
56 name = name.replaceAll("%w", Integer.toString(size));
57 return getIcon(name);
58 }
59
60 }