com.digi.config.util
Class ImageResourceBundle
java.lang.Object
java.util.ResourceBundle
com.digi.config.util.ImageResourceBundle
- public class ImageResourceBundle
- extends java.util.ResourceBundle
This is a special purpose resource bundle that allows the Config UI classes
to easily access imageIcons. Use this resource bundle similar to any other
resource bundle. For example, the following code segment shows how to access
and use the bundle to get imageIcons:
ImageResourceBundle irb = ResourceBundle.
getBundle("com.digi.util.ImageResourceBundle");
ImageIcon icon = irb.getImageIcon("PrintThis");
The lookup is actually performed in a two step process. First, the name of
the image file is looked up in the property file
"ConfigImgResourceBundle.properties". This file contains a collection of
imageName->ImageFileName pairs. Once the file name has been located, an
IconImage is created for that file and is returned to the caller.
Note: Since the image file names are located in a resource file, it is easy
to provide locale specific icons by providing a property file for each locale
and changing the file name mappings to the appropriate locale icons.
| Fields inherited from class java.util.ResourceBundle |
parent |
|
Constructor Summary |
ImageResourceBundle(java.lang.String imageResourceBundleName)
Construct a new ImageResourceBundle.
|
|
Method Summary |
javax.swing.ImageIcon |
getImageIcon(java.lang.String key)
Fetches the proper image icon for the specified image name.
|
java.util.Enumeration |
getKeys()
Returns all the available image keys in the image resource bundle. |
java.lang.Object |
handleGetObject(java.lang.String key)
Fetches the proper image icon for the specified image name.
|
| 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 |
ImageResourceBundle
public ImageResourceBundle(java.lang.String imageResourceBundleName)
throws java.util.MissingResourceException
- Construct a new ImageResourceBundle.
The constructor ensures that the image resource bundle has been located so that
subsequent lookups can use it.
getKeys
public java.util.Enumeration getKeys()
- Returns all the available image keys in the image resource bundle.
- Returns:
- Enumeration of image keys
handleGetObject
public java.lang.Object handleGetObject(java.lang.String key)
- Fetches the proper image icon for the specified image name.
This method accomplishes its work by first looking up the image file
name in the image resource bundle and then locates and creates an icon
for the specified file. If the image is not found, it will log a message
and return a default image.
- Returns:
- ImageIcon object associated with the key
getImageIcon
public javax.swing.ImageIcon getImageIcon(java.lang.String key)
- Fetches the proper image icon for the specified image name.
This method accomplishes its work by first looking up the image file
name in the image resource bundle and then locates and creates an icon
for the specified file. If the image is not found, it will log a message
and return a default image.
- Returns:
- ImageIcon object associated with the key
Copyright © 2001-2002 Digi International. All Rights Reserved.