|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object biz.chitec.quarterback.swing.ResourceLoader
Helper class to load more complex resources more conveniently. This class helps loading resources relative to classpath and independent from the distribution. It works in files-in-directories environment as good as in JAR file environment (which was quit a hard task to accomplish with).
It is possible to set prefixes on different resource types which are used automatically when loading.
Field Summary | |
private static java.lang.ClassLoader |
cl
|
private static java.util.List |
iconprefixes
|
private static java.util.List |
resourceprefixes
|
Constructor Summary | |
private |
ResourceLoader()
Uninstanciable as all methods are static. |
Method Summary | |
static void |
addIconPath(java.lang.String px)
Set general prefix for icons. |
static void |
addResourcePath(java.lang.String px)
Set general prefix for resource files. |
static java.awt.image.BufferedImage |
getBufferedImage(java.lang.String resourcefile)
Return a BufferedImage from image data stored in a file (e.g. contained in the JAR). |
static javax.swing.Icon |
getIcon(java.lang.String resourcefile)
Compatibility method which returns an Icon object without description. |
static javax.swing.Icon |
getIcon(java.lang.String resourcefile,
java.lang.String icondescription)
Compatibility method which returns an Icon object. |
static javax.swing.ImageIcon |
getImageIcon(java.lang.String resourcefile)
Convenience method without icon description. |
static javax.swing.ImageIcon |
getImageIcon(java.lang.String resourcefile,
java.lang.String icondescription)
Return an ImageIcon stored in a file (e.g. contained in the JAR). |
static javax.swing.ImageIcon |
getImageIconOrNull(java.lang.String resourcefile)
Convenience method without icon description. |
static javax.swing.ImageIcon |
getImageIconOrNull(java.lang.String resourcefile,
java.lang.String icondescription)
Return an ImageIcon stored in a file (e.g. contained in the JAR). |
private static java.net.URL |
getImageURL(java.lang.String resourcefile)
Locates an image by the given URL along the iconprefixes. |
static java.net.URL |
getResourceURL(java.lang.String resourcefile)
Locates an image by the given URL along the iconprefixes. |
static java.net.URL |
getURL(java.lang.String resourcefile)
Return an URL to any kind of resource. |
static void |
setClassLoader(java.lang.ClassLoader clx)
Sets the class loader. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static java.util.List iconprefixes
private static java.util.List resourceprefixes
private static java.lang.ClassLoader cl
Constructor Detail |
private ResourceLoader()
Method Detail |
public static final java.net.URL getURL(java.lang.String resourcefile)
resourcefile
- The name of the resource to be referenced
private static final java.net.URL getImageURL(java.lang.String resourcefile)
public static final java.net.URL getResourceURL(java.lang.String resourcefile)
public static final java.awt.image.BufferedImage getBufferedImage(java.lang.String resourcefile)
resourcefile
- File containing the image data. Relative to paths in iconprefixes.
public static final javax.swing.ImageIcon getImageIconOrNull(java.lang.String resourcefile, java.lang.String icondescription)
resourcefile
- The file with the resource in question. Relative to paths in iconprefixicondescription
- Textual description of the icon. May be null.
public static final javax.swing.ImageIcon getImageIcon(java.lang.String resourcefile, java.lang.String icondescription)
resourcefile
- The file with the resource in question. Relative to paths in iconprefixicondescription
- Textual description of the icon. May be null.
public static javax.swing.ImageIcon getImageIconOrNull(java.lang.String resourcefile)
resourcefile
- Name of the image resource
public static javax.swing.ImageIcon getImageIcon(java.lang.String resourcefile)
resourcefile
- Name of the image resource
public static javax.swing.Icon getIcon(java.lang.String resourcefile, java.lang.String icondescription)
resourcefile
- The file with the resource in question. Relative to paths in iconprefixicondescription
- Textual description of the icon. May be null.
public static javax.swing.Icon getIcon(java.lang.String resourcefile)
resourcefile
- The file with the resource in question. Relative to paths in iconprefix
public static void addIconPath(java.lang.String px)
public static void addResourcePath(java.lang.String px)
public static void setClassLoader(java.lang.ClassLoader clx)
|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |