Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## contrib.ch.randelshofer.quaqua.util
Class ResourceBundleUtil

    java.lang.Object
      contrib.ch.randelshofer.quaqua.util.ResourceBundleUtil

    public class ResourceBundleUtil

extends java.lang.Object

This is a convenience wrapper for accessing resources stored in a ResourceBundle.

Version:
  1,3.3 2005-11-07 Method getLocale added.
  1.3.2 2004-05-02 Method getLAFBundle without Locale as parameter added.
  1.3.1 2002-07-30 Method getLAFBundle now takes a Locale as an additional parameter.
  1.3 2001-10-10 The default resource name changed from 'name_Metal' to 'name'.
  1.2 2001-07-23 Adaptation to JDK 1.3 in progress.
  1.0 2000-06-10 Created.
Author:
  Werner Randelshofer, Staldenmattweg 2, CH-6405 Immensee, Switzerland

Constructor Summary
`ResourceBundleUtil(java.util.ResourceBundle r)` Creates a new ResouceBundleUtil which wraps the provided resource bundle.

Method Summary
`javax.swing.KeyStroke` | `getAcc(java.lang.String key)` Get a KeyStroke from the ResourceBundle.
`static ResourceBundleUtil` | `getBundle(java.lang.String baseName)` Get the appropriate ResourceBundle subclass.
`java.lang.String` | `getFormatted(java.lang.String key, java.lang.Object argument)`
`java.lang.String` | `getFormatted(java.lang.String key, java.lang.Object[] arguments)`
`javax.swing.ImageIcon` | `getImageIcon(java.lang.String key, java.lang.Class baseClass)` Get an image icon from the ResourceBundle.
`javax.swing.KeyStroke` | `getKeyStroke(java.lang.String key)` Get a KeyStroke from the ResourceBundle.
`static ResourceBundleUtil` | `getLAFBundle(java.lang.String baseName)` Get the appropriate ResourceBundle subclass.
`static ResourceBundleUtil` | `getLAFBundle(java.lang.String baseName, java.util.Locale locale)` Get the appropriate ResourceBundle subclass.
`java.util.Locale` | `getLocale()`
`char` | `getMnem(java.lang.String key)` Get a Mnemonic from the ResourceBundle.
`char` | `getMnemonic(java.lang.String key)` Get a Mnemonic from the ResourceBundle.
`java.lang.String` | `getString(java.lang.String key)` Get a String from the ResourceBundle.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ResourceBundleUtil

    public ResourceBundleUtil(java.util.ResourceBundle r)

  Creates a new ResouceBundleUtil which wraps the provided resource bundle.

Method Detail

### getString

    public java.lang.String getString(java.lang.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 javax.swing.ImageIcon getImageIcon(java.lang.String key,
                                              java.lang.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(java.lang.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(java.lang.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 javax.swing.KeyStroke getKeyStroke(java.lang.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 javax.swing.KeyStroke getAcc(java.lang.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.

### getFormatted

    public java.lang.String getFormatted(java.lang.String key,
                                         java.lang.Object argument)

### getFormatted

    public java.lang.String getFormatted(java.lang.String key,
                                         java.lang.Object[] arguments)

### getLocale

    public java.util.Locale getLocale()

### getBundle

    public static ResourceBundleUtil getBundle(java.lang.String baseName)
                                        throws java.util.MissingResourceException

  Get the appropriate ResourceBundle subclass.

  Throws:
    `java.util.MissingResourceException`
  See Also:
    `ResourceBundle`

### getLAFBundle

    public static ResourceBundleUtil getLAFBundle(java.lang.String baseName)
                                           throws java.util.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:
    `java.util.MissingResourceException`
  See Also:
    `ResourceBundle`

### getLAFBundle

    public static ResourceBundleUtil getLAFBundle(java.lang.String baseName,
                                                  java.util.Locale locale)
                                           throws java.util.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:
    `java.util.MissingResourceException`
  See Also:
    `ResourceBundle`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD