From 11eb9557a35e17450c0aefb758471f1ff3148336 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 29 Jun 2012 16:20:11 +0200 Subject: Pull remaining graph GUI components into cristal-gui --- src/main/java/com/c2kernel/utils/Resource.java | 53 -------------------------- 1 file changed, 53 deletions(-) (limited to 'src/main/java/com/c2kernel/utils') diff --git a/src/main/java/com/c2kernel/utils/Resource.java b/src/main/java/com/c2kernel/utils/Resource.java index 10228da..3065f6a 100644 --- a/src/main/java/com/c2kernel/utils/Resource.java +++ b/src/main/java/com/c2kernel/utils/Resource.java @@ -6,8 +6,6 @@ import java.net.URL; import java.util.HashMap; import java.util.Hashtable; -import javax.swing.ImageIcon; - import com.c2kernel.common.ObjectNotFoundException; /************************************************************************** @@ -17,10 +15,8 @@ import com.c2kernel.common.ObjectNotFoundException; **************************************************************************/ public class Resource { static private Hashtable txtCache = new Hashtable(); - static private Hashtable imgCache = new Hashtable(); static private URL baseURL = getURLorResURL("com/c2kernel/utils/resources/"); static private HashMap moduleBaseURLs = new HashMap(); - static public final ImageIcon nullImg = new ImageIcon(new byte[] { 0 }); public static URL getKernelBaseURL() { return baseURL; @@ -105,55 +101,6 @@ public class Resource { throw new ObjectNotFoundException(e.getMessage(),null); } } - /** - * Gets an image from the resource directories - * - * @param resName - filename after resources/images - * @return - */ - static public ImageIcon findImage(String resName) { - try { - for (String ns : getModuleBaseURLs().keySet()) { - try { - return getImage(ns, resName); - } catch (ObjectNotFoundException ex) { } - } - return getImage(null, resName); - } catch (ObjectNotFoundException ex) { - Logger.warning("Image '"+resName+"' not found. Using null icon"); - return nullImg; - } - } - - static public ImageIcon getImage(String ns, String resName) throws ObjectNotFoundException { - if (resName == null) - return nullImg; - - if (imgCache.containsKey(ns+'/'+resName)) { - return imgCache.get(ns+'/'+resName); - } - - URL imgLocation = null; - if (ns == null) - try { - imgLocation = getKernelResourceURL("images/"+resName); - } catch (MalformedURLException ex) { } - else - try { - imgLocation = getModuleResourceURL(ns, "images/"+resName); - } catch (MalformedURLException ex) { } - - if (imgLocation!= null) { - ImageIcon newImg = new ImageIcon(imgLocation); - - if (newImg.getIconHeight() > -1) { - imgCache.put(ns+'/'+resName, newImg); - Logger.msg(0, "Loaded "+resName+" "+newImg.getIconWidth()+"x"+newImg.getIconHeight()); - return newImg; - } - } - throw new ObjectNotFoundException(); - } static public String getKernelVersion() { try { -- cgit v1.2.3