net.sf.sfac.utils
Class ResourceUtils

java.lang.Object
  extended by net.sf.sfac.utils.ResourceUtils

public abstract class ResourceUtils
extends Object


Constructor Summary
ResourceUtils()
           
 
Method Summary
static String getFullResourceName(Class<?> baseClass, String resourceName)
          Get the full name (including path) of a resource (absolute or relative to the given class).
static ImageIcon getImageIcon(Class<?> baseClass, String resourceName)
          Get an image icon resource with given path (absolute or relative to the given class).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceUtils

public ResourceUtils()
Method Detail

getFullResourceName

public static String getFullResourceName(Class<?> baseClass,
                                         String resourceName)
Get the full name (including path) of a resource (absolute or relative to the given class). (Used mostly to display correct error message because the classLoader can resolve this path itself).

Parameters:
baseClass - used as base to resolve relative paths.
resourceName - Path to the resource (absolute or relative to the given class).
Returns:
the absolute resource path.

getImageIcon

public static ImageIcon getImageIcon(Class<?> baseClass,
                                     String resourceName)
Get an image icon resource with given path (absolute or relative to the given class).

Parameters:
baseClass - used as base to resolve relative paths.
resourceName - Path to the image resource (absolute or relative to the given class)
Returns:
the requested image icon.
Throws:
IllegalArgumentException - if there is no resource with the given name or if the resource is not an image.


Copyright © 2012. All Rights Reserved.