|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.ResourceBundle
diva.resource.RelativeBundle
public class RelativeBundle
A class for managing resources. This class is an extension to the standard ResourceBundle that allows you to construct ResourceBundles that
Field Summary | |
---|---|
private java.util.ResourceBundle |
_delegate
The actual ResourceBundle |
private java.util.HashMap |
_imageIcons
Icons that have already been loaded |
private java.lang.Class |
_loader
The class that is to be used to look up URL resources from this bundle. |
Fields inherited from class java.util.ResourceBundle |
---|
parent |
Constructor Summary | |
---|---|
RelativeBundle(java.lang.String baseName,
java.lang.Class loader,
java.util.ResourceBundle overrides)
Create a new RelativeBundle using the given basename, with the given class as the loader for URL-based resources, and with the given ResourceBundle as the one that gets overridden. |
Method Summary | |
---|---|
java.awt.Image |
getImage(java.lang.String key)
Get a resource as an image. |
javax.swing.ImageIcon |
getImageIcon(java.lang.String key)
Get a resource as an image icon. |
java.util.Enumeration |
getKeys()
Get an enumeration over the keys |
java.net.URL |
getResource(java.lang.String key)
Get a resource as an absolute URL. |
java.io.InputStream |
getResourceAsStream(java.lang.String key)
Get a resource as an input stream. |
protected java.lang.Object |
handleGetObject(java.lang.String key)
Get an object from a ResourceBundle. |
Methods inherited from class java.util.ResourceBundle |
---|
getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, setParent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.Class _loader
private java.util.HashMap _imageIcons
private java.util.ResourceBundle _delegate
Constructor Detail |
---|
public RelativeBundle(java.lang.String baseName, java.lang.Class loader, java.util.ResourceBundle overrides)
RelativeBundle default = new diva.resource.Default(); RelativeBundle resource = new RelativeBundle( "mypackage.resource.MyResources", getClass(), default);In this example, the file mypackage/resource/MyResource.properties would contain resource such asLoadImage = resources/load.gif SaveImage = resources/save.gifIf you don't mind cluttering up your source directory with resource files, then it's probably better to put the resource file in the same directory as the application classes, so the properties files doesn't need the "resources/" strings.
Method Detail |
---|
public java.net.URL getResource(java.lang.String key)
public java.io.InputStream getResourceAsStream(java.lang.String key)
public javax.swing.ImageIcon getImageIcon(java.lang.String key)
public java.awt.Image getImage(java.lang.String key)
protected java.lang.Object handleGetObject(java.lang.String key) throws java.util.MissingResourceException
handleGetObject
in class java.util.ResourceBundle
java.util.MissingResourceException
public java.util.Enumeration getKeys()
getKeys
in class java.util.ResourceBundle
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |