Class ResourceBundleUtil
- java.lang.Object
-
- org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.util.ResourceBundleUtil
-
public class ResourceBundleUtil extends Object
This is a convenience wrapper for accessing resources stored in a ResourceBundle.
-
-
Constructor Summary
Constructors Constructor Description ResourceBundleUtil(ResourceBundle r)
Creates a new ResouceBundleUtil which wraps the provided resource bundle.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description KeyStroke
getAcc(String key)
Get a KeyStroke from the ResourceBundle.static ResourceBundleUtil
getBundle(String baseName)
Get the appropriate ResourceBundle subclass.String
getFormatted(String key, Object argument)
String
getFormatted(String key, Object[] arguments)
ImageIcon
getImageIcon(String key, Class baseClass)
Get an image icon from the ResourceBundle.KeyStroke
getKeyStroke(String key)
Get a KeyStroke from the ResourceBundle.static ResourceBundleUtil
getLAFBundle(String baseName)
Get the appropriate ResourceBundle subclass.static ResourceBundleUtil
getLAFBundle(String baseName, Locale locale)
Get the appropriate ResourceBundle subclass.Locale
getLocale()
char
getMnem(String key)
Get a Mnemonic from the ResourceBundle.char
getMnemonic(String key)
Get a Mnemonic from the ResourceBundle.String
getString(String key)
Get a String from the ResourceBundle.
-
-
-
Constructor Detail
-
ResourceBundleUtil
public ResourceBundleUtil(ResourceBundle r)
Creates a new ResouceBundleUtil which wraps the provided resource bundle.
-
-
Method Detail
-
getString
public String getString(String key)
Get a String from the ResourceBundle.
Convenience method to save casting.- Parameters:
key
- The key of the property.- Returns:
- The value of the property. Returns the key if the property is missing.
-
getImageIcon
public ImageIcon getImageIcon(String key, Class baseClass)
Get an image icon from the ResourceBundle.
Convenience method .- Parameters:
key
- The key of the property.- Returns:
- The value of the property. Returns null if the property is missing.
-
getMnemonic
public char getMnemonic(String key)
Get a Mnemonic from the ResourceBundle.
Convenience method.- Parameters:
key
- The key of the property.- Returns:
- The first char of the value of the property. Returns '\0' if the property is missing.
-
getMnem
public char getMnem(String key)
Get a Mnemonic from the ResourceBundle.
Convenience method.- Parameters:
key
- The key of the property. This method appends "Mnem" to the key.- Returns:
- The first char of the value of the property. Returns '\0' if the property is missing.
-
getKeyStroke
public KeyStroke getKeyStroke(String key)
Get a KeyStroke from the ResourceBundle.
Convenience method.- Parameters:
key
- The key of the property.- Returns:
javax.swing.KeyStroke.getKeyStroke(value)
. Returns null if the property is missing.
-
getAcc
public KeyStroke getAcc(String key)
Get a KeyStroke from the ResourceBundle.
Convenience method.- Parameters:
key
- The key of the property. This method adds "Acc" to the key.- Returns:
javax.swing.KeyStroke.getKeyStroke(value)
. Returns null if the property is missing.
-
getLocale
public Locale getLocale()
-
getBundle
public static ResourceBundleUtil getBundle(String baseName) throws MissingResourceException
Get the appropriate ResourceBundle subclass.- Throws:
MissingResourceException
- See Also:
ResourceBundle
-
getLAFBundle
public static ResourceBundleUtil getLAFBundle(String baseName) throws MissingResourceException
Get the appropriate ResourceBundle subclass. The baseName is extended by the Swing Look and Feel ID and by the Locale code returned by Locale.getDefault(). The default Look and Feel ID is Metal.- Throws:
MissingResourceException
- See Also:
ResourceBundle
-
getLAFBundle
public static ResourceBundleUtil getLAFBundle(String baseName, Locale locale) throws MissingResourceException
Get the appropriate ResourceBundle subclass. The baseName is extended by the Swing Look and Feel ID and by the Locale code. The default Look and Feel ID is Metal.- Throws:
MissingResourceException
- See Also:
ResourceBundle
-
-