public class RelativeBundle extends ResourceBundle
ResourceBundle.Controlparent| Constructor and Description |
|---|
RelativeBundle(String baseName,
Class loader,
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.
|
| Modifier and Type | Method and Description |
|---|---|
Image |
getImage(String key)
Get a resource as an image.
|
ImageIcon |
getImageIcon(String key)
Get a resource as an image icon.
|
Enumeration |
getKeys()
Get an enumeration over the keys
|
URL |
getResource(String key)
Get a resource as an absolute URL.
|
InputStream |
getResourceAsStream(String key)
Get a resource as an input stream.
|
protected Object |
handleGetObject(String key)
Get an object from a ResourceBundle.
|
clearCache, clearCache, containsKey, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, handleKeySet, keySet, setParentpublic RelativeBundle(String baseName, Class loader, 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 as
LoadImage = resources/load.gif
SaveImage = resources/save.gif
If 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.
public InputStream getResourceAsStream(String key)
public ImageIcon getImageIcon(String key)
public Image getImage(String key)
protected Object handleGetObject(String key) throws MissingResourceException
handleGetObject in class ResourceBundleMissingResourceExceptionpublic Enumeration getKeys()
getKeys in class ResourceBundleCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.