1 28 29 package org.objectweb.fractal.explorer.icon; 30 31 import java.util.HashMap ; 32 import java.util.Map ; 33 34 import javax.swing.Icon ; 35 import javax.swing.ImageIcon ; 36 37 import org.objectweb.util.explorer.api.IconProvider; 38 39 44 public abstract class InterfaceIconProvider 45 implements IconProvider 46 { 47 53 54 55 protected Map icons ; 56 57 60 protected Map getIcons() { 61 return icons; 62 } 63 66 protected void setIcons(Map icons) { 67 this.icons = icons; 68 } 69 70 75 protected Icon load(String path) { 76 Icon icon = new ImageIcon (Thread.currentThread().getContextClassLoader().getResource(path)); 77 if (icon == null) 78 System.err.println(path+" icon not found!"); 79 return icon ; 80 } 81 82 86 protected void loadFc(String name) { 87 getIcons().put(name, load("icons/Fc"+name+".png")); 88 } 89 90 93 protected InterfaceIconProvider() { 94 setIcons(new HashMap ()); 95 } 96 } 97 | Popular Tags |