| java.lang.Object org.jfree.util.ResourceBundleSupport
ResourceBundleSupport | public class ResourceBundleSupport (Code) | | An utility class to ease up using property-file resource bundles.
The class support references within the resource bundle set to minimize the
occurence of duplicate keys. References are given in the format:
a.key.name=@referenced.key
A lookup to a key in an other resource bundle should be written by
a.key.name=@@resourcebundle_name@referenced.key
author: Thomas Morgner |
ResourceBundleSupport | public ResourceBundleSupport(Locale locale, String baseName)(Code) | | Creates a new instance.
Parameters: baseName - the base name of the resource bundle, a fully qualifiedclass name |
ResourceBundleSupport | protected ResourceBundleSupport(Locale locale, ResourceBundle resourceBundle, String baseName)(Code) | | Creates a new instance.
Parameters: locale - the locale for which this resource bundle iscreated. Parameters: resourceBundle - the resourcebundle Parameters: baseName - the base name of the resource bundle, a fullyqualified class name |
ResourceBundleSupport | public ResourceBundleSupport(Locale locale, ResourceBundle resourceBundle)(Code) | | Creates a new instance.
Parameters: locale - the locale for which the resource bundle iscreated. Parameters: resourceBundle - the resourcebundle |
ResourceBundleSupport | public ResourceBundleSupport(String baseName)(Code) | | Creates a new instance.
Parameters: baseName - the base name of the resource bundle, a fully qualifiedclass name |
ResourceBundleSupport | protected ResourceBundleSupport(ResourceBundle resourceBundle, String baseName)(Code) | | Creates a new instance.
Parameters: resourceBundle - the resourcebundle Parameters: baseName - the base name of the resource bundle, a fullyqualified class name |
ResourceBundleSupport | public ResourceBundleSupport(ResourceBundle resourceBundle)(Code) | | Creates a new instance.
Parameters: resourceBundle - the resourcebundle |
createMenu | public JMenu createMenu(String keyPrefix)(Code) | | Returns a JMenu created from a resource bundle definition.
The menu definition consists of two keys, the name of the menu and the
mnemonic for that menu. Both keys share a common prefix, which is
extended by ".name" for the name of the menu and ".mnemonic" for the
mnemonic.
# define the file menu
menu.file.name=File
menu.file.mnemonic=F
The menu definition above can be used to create the menu by calling
createMenu ("menu.file") .
Parameters: keyPrefix - the common prefix for that menu the created menu |
createTransparentIcon | public Icon createTransparentIcon(int width, int height)(Code) | | Creates a transparent icon. The Icon can be used for aligning menu
items.
Parameters: width - the width of the new icon Parameters: height - the height of the new icon the created transparent icon. |
formatMessage | public String formatMessage(String key, Object parameter)(Code) | | Formats the message stored in the resource bundle (using a
MessageFormat).
Parameters: key - the resourcebundle key Parameters: parameter - the parameter for the message the formated string |
formatMessage | public String formatMessage(String key, Object par1, Object par2)(Code) | | Formats the message stored in the resource bundle (using a
MessageFormat).
Parameters: key - the resourcebundle key Parameters: par1 - the first parameter for the message Parameters: par2 - the second parameter for the message the formated string |
formatMessage | public String formatMessage(String key, Object[] parameters)(Code) | | Formats the message stored in the resource bundle (using a
MessageFormat).
Parameters: key - the resourcebundle key Parameters: parameters - the parameter collection for the message the formated string |
getIcon | public Icon getIcon(String key, boolean large)(Code) | | Returns an scaled icon suitable for buttons or menus.
Parameters: key - the name of the resource bundle key Parameters: large - true, if the image should be scaled to 24x24, or false for16x16 the icon. |
getIcon | public Icon getIcon(String key)(Code) | | Returns an unscaled icon.
Parameters: key - the name of the resource bundle key the icon. |
getKeyStroke | public KeyStroke getKeyStroke(String key)(Code) | | Returns the keystroke stored at the given resourcebundle key.
The keystroke will be composed of a simple key press and the plattform's
MenuKeyMask.
The keystrokes character key should be either the symbolic name of one of
the KeyEvent.VK_* constants or the character for that key.
For the 'A' key, the resource bundle would therefore either contain
"VK_A" or "a".
a.resourcebundle.key=VK_A
an.other.resourcebundle.key=a
Parameters: key - the resourcebundle key the mnemonic See Also: Toolkit.getMenuShortcutKeyMask |
getKeyStroke | public KeyStroke getKeyStroke(String key, int mask)(Code) | | Returns the keystroke stored at the given resourcebundle key.
The keystroke will be composed of a simple key press and the given
KeyMask. If the KeyMask is zero, a plain Keystroke is returned.
The keystrokes character key should be either the symbolic name of one of
the KeyEvent.VK_* constants or the character for that key.
For the 'A' key, the resource bundle would therefore either contain
"VK_A" or "a".
a.resourcebundle.key=VK_A
an.other.resourcebundle.key=a
Parameters: key - the resourcebundle key the mnemonic See Also: Toolkit.getMenuShortcutKeyMask |
getLocale | public Locale getLocale()(Code) | | Returns the current locale for this resource bundle.
the locale. |
getMnemonic | public Integer getMnemonic(String key)(Code) | | Returns the mnemonic stored at the given resourcebundle key. The mnemonic
should be either the symbolic name of one of the KeyEvent.VK_* constants
(without the 'VK_') or the character for that key.
For the enter key, the resource bundle would therefore either contain
"ENTER" or "\n".
a.resourcebundle.key=ENTER
an.other.resourcebundle.key=\n
Parameters: key - the resourcebundle key the mnemonic |
getResourceBase | final protected String getResourceBase()(Code) | | The base name of the resource bundle.
the resource bundle's name. |
getResourceURL | public URL getResourceURL(String key)(Code) | | Returns a URL pointing to a resource located in the classpath. The
resource is looked up using the given key.
Example: The load a file named 'logo.gif' which is stored in a java
package named 'org.jfree.resources':
mainmenu.logo=org/jfree/resources/logo.gif
The URL for that file can be queried with: getResource("mainmenu.logo"); .
Parameters: key - the key for the resource the resource URL |
getString | public synchronized String getString(String key)(Code) | | Gets a string for the given key from this resource bundle or one of its
parents. If the key is a link, the link is resolved and the referenced
string is returned instead.
Parameters: key - the key for the desired string the string for the given key throws: NullPointerException - if key is null throws: MissingResourceException - if no object for the given key can befound throws: ClassCastException - if the object found for the given key isnot a string |
internalGetString | protected String internalGetString(String key)(Code) | | Performs the lookup for the given key. If the key points to a link the
link is resolved and that key is looked up instead.
Parameters: key - the key for the string the string for the given key |
|
|