01: /*
02: * $Header: /cvs/j3dfly/J3dEditor/src/org/jdesktop/j3dedit/scenegrapheditor/TreeIconControl.java,v 1.1 2005/04/20 22:20:49 paulby Exp $
03: *
04: * Sun Public License Notice
05: *
06: * The contents of this file are subject to the Sun Public License Version
07: * 1.0 (the "License"). You may not use this file except in compliance with
08: * the License. A copy of the License is available at http://www.sun.com/
09: *
10: * The Original Code is the Java 3D(tm) Scene Graph Editor.
11: * The Initial Developer of the Original Code is Paul Byrne.
12: * Portions created by Paul Byrne are Copyright (C) 2002.
13: * All Rights Reserved.
14: *
15: * Contributor(s): Paul Byrne.
16: *
17: **/
18: package org.jdesktop.j3dedit.scenegrapheditor;
19:
20: import java.util.HashMap;
21:
22: /**
23: * Maintains a reference between the Java3D Node classes and the image
24: * that represents them in the J3dTreePanel
25: *
26: * @author Paul Byrne
27: * @version $Id: TreeIconControl.java,v 1.1 2005/04/20 22:20:49 paulby Exp $
28: */
29: public class TreeIconControl extends Object {
30:
31: private HashMap hashMap = new HashMap();
32:
33: /** Creates new TreeIconControl */
34: public TreeIconControl() {
35: }
36:
37: public void addImage(Class j3dClass, java.awt.Image image) {
38: hashMap.put(j3dClass, image);
39: }
40:
41: /**
42: * @deprecated use addImage( j3dClass, image );
43: */
44: public void addImage(Class j3dClass, String imageFilename) {
45: try {
46: javax.swing.ImageIcon imageIcon = new javax.swing.ImageIcon(
47: getClass().getResource(imageFilename));
48: java.awt.Image im = imageIcon.getImage();
49: addImage(j3dClass, im);
50: } catch (Exception e) {
51: System.out.println("Unable to load icon " + imageFilename);
52: }
53: }
54:
55: public java.awt.Image getImage(Class j3dClass) {
56: return (java.awt.Image) hashMap.get(j3dClass);
57: }
58:
59: }
|