public class ResourceBundleSupport extends java.lang.Object
a.key.name=@referenced.keyA lookup to a key in an other resource bundle should be written by
a.key.name=@@resourcebundle_name@referenced.key
Modifier | Constructor and Description |
---|---|
|
ResourceBundleSupport(java.util.Locale locale,
java.util.ResourceBundle resourceBundle)
Creates a new instance.
|
protected |
ResourceBundleSupport(java.util.Locale locale,
java.util.ResourceBundle resourceBundle,
java.lang.String baseName)
Creates a new instance.
|
|
ResourceBundleSupport(java.util.Locale locale,
java.lang.String baseName)
Creates a new instance.
|
|
ResourceBundleSupport(java.util.ResourceBundle resourceBundle)
Creates a new instance.
|
protected |
ResourceBundleSupport(java.util.ResourceBundle resourceBundle,
java.lang.String baseName)
Creates a new instance.
|
|
ResourceBundleSupport(java.lang.String baseName)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
javax.swing.JMenu |
createMenu(java.lang.String keyPrefix)
Returns a JMenu created from a resource bundle definition.
|
javax.swing.Icon |
createTransparentIcon(int width,
int height)
Creates a transparent icon.
|
java.lang.String |
formatMessage(java.lang.String key,
java.lang.Object parameter)
Formats the message stored in the resource bundle (using a
MessageFormat).
|
java.lang.String |
formatMessage(java.lang.String key,
java.lang.Object[] parameters)
Formats the message stored in the resource bundle (using a
MessageFormat).
|
java.lang.String |
formatMessage(java.lang.String key,
java.lang.Object par1,
java.lang.Object par2)
Formats the message stored in the resource bundle (using a
MessageFormat).
|
javax.swing.Icon |
getIcon(java.lang.String key)
Returns an unscaled icon.
|
javax.swing.Icon |
getIcon(java.lang.String key,
boolean large)
Returns an scaled icon suitable for buttons or menus.
|
javax.swing.KeyStroke |
getKeyStroke(java.lang.String key)
Returns the keystroke stored at the given resourcebundle key.
|
javax.swing.KeyStroke |
getKeyStroke(java.lang.String key,
int mask)
Returns the keystroke stored at the given resourcebundle key.
|
java.util.Locale |
getLocale()
Returns the current locale for this resource bundle.
|
java.lang.Integer |
getMnemonic(java.lang.String key)
Returns the mnemonic stored at the given resourcebundle key.
|
javax.swing.KeyStroke |
getOptionalKeyStroke(java.lang.String key)
Returns an optional key stroke.
|
javax.swing.KeyStroke |
getOptionalKeyStroke(java.lang.String key,
int mask)
Returns an optional key stroke.
|
java.lang.Integer |
getOptionalMnemonic(java.lang.String key)
Returns an optional mnemonic.
|
protected java.lang.String |
getResourceBase()
The base name of the resource bundle.
|
java.net.URL |
getResourceURL(java.lang.String key)
Returns a URL pointing to a resource located in the classpath.
|
java.lang.String |
getString(java.lang.String key)
Gets a string for the given key from this resource bundle or one of its
parents.
|
protected java.lang.String |
internalGetString(java.lang.String key)
Performs the lookup for the given key.
|
public ResourceBundleSupport(java.util.Locale locale, java.lang.String baseName)
locale
- the locale.baseName
- the base name of the resource bundle, a fully qualified
class nameprotected ResourceBundleSupport(java.util.Locale locale, java.util.ResourceBundle resourceBundle, java.lang.String baseName)
locale
- the locale for which this resource bundle is
created.resourceBundle
- the resourcebundlebaseName
- the base name of the resource bundle, a fully
qualified class namepublic ResourceBundleSupport(java.util.Locale locale, java.util.ResourceBundle resourceBundle)
locale
- the locale for which the resource bundle is
created.resourceBundle
- the resourcebundlepublic ResourceBundleSupport(java.lang.String baseName)
baseName
- the base name of the resource bundle, a fully qualified
class nameprotected ResourceBundleSupport(java.util.ResourceBundle resourceBundle, java.lang.String baseName)
resourceBundle
- the resourcebundlebaseName
- the base name of the resource bundle, a fully
qualified class namepublic ResourceBundleSupport(java.util.ResourceBundle resourceBundle)
resourceBundle
- the resourcebundleprotected final java.lang.String getResourceBase()
public java.lang.String getString(java.lang.String key)
key
- the key for the desired stringjava.lang.NullPointerException
- if key
is null
java.util.MissingResourceException
- if no object for the given key can be
foundjava.lang.ClassCastException
- if the object found for the given key is
not a stringprotected java.lang.String internalGetString(java.lang.String key)
key
- the key for the stringpublic javax.swing.Icon getIcon(java.lang.String key, boolean large)
key
- the name of the resource bundle keylarge
- true, if the image should be scaled to 24x24, or false for
16x16public javax.swing.Icon getIcon(java.lang.String key)
key
- the name of the resource bundle keypublic java.lang.Integer getMnemonic(java.lang.String key)
a.resourcebundle.key=ENTER an.other.resourcebundle.key=\n
key
- the resourcebundle keypublic java.lang.Integer getOptionalMnemonic(java.lang.String key)
key
- the key.public javax.swing.KeyStroke getKeyStroke(java.lang.String key)
a.resourcebundle.key=VK_A an.other.resourcebundle.key=a
key
- the resourcebundle keyToolkit.getMenuShortcutKeyMask()
public javax.swing.KeyStroke getOptionalKeyStroke(java.lang.String key)
key
- the key.public javax.swing.KeyStroke getKeyStroke(java.lang.String key, int mask)
a.resourcebundle.key=VK_A an.other.resourcebundle.key=a
key
- the resourcebundle key.mask
- the mask.Toolkit.getMenuShortcutKeyMask()
public javax.swing.KeyStroke getOptionalKeyStroke(java.lang.String key, int mask)
key
- the key.mask
- the mask.public javax.swing.JMenu createMenu(java.lang.String keyPrefix)
# define the file menu menu.file.name=File menu.file.mnemonic=FThe menu definition above can be used to create the menu by calling
createMenu ("menu.file")
.keyPrefix
- the common prefix for that menupublic java.net.URL getResourceURL(java.lang.String key)
mainmenu.logo=org/jfree/resources/logo.gifThe URL for that file can be queried with:
getResource("mainmenu.logo");
.key
- the key for the resourcepublic javax.swing.Icon createTransparentIcon(int width, int height)
width
- the width of the new iconheight
- the height of the new iconpublic java.lang.String formatMessage(java.lang.String key, java.lang.Object parameter)
key
- the resourcebundle keyparameter
- the parameter for the messagepublic java.lang.String formatMessage(java.lang.String key, java.lang.Object par1, java.lang.Object par2)
key
- the resourcebundle keypar1
- the first parameter for the messagepar2
- the second parameter for the messagepublic java.lang.String formatMessage(java.lang.String key, java.lang.Object[] parameters)
key
- the resourcebundle keyparameters
- the parameter collection for the messagepublic java.util.Locale getLocale()