jgnash.util
Class Resource

java.lang.Object
  extended by jgnash.util.Resource

public class Resource
extends java.lang.Object

This class controls the application locale and provides localized strings, keystrokes, graphics, etc.

Version:
$Id$
Author:
Craig Cavanaugh

Field Summary
private static java.lang.String DEFAULT_BUNDLE
           
private static java.lang.String LOCALE
          key for locale preference
private static java.util.logging.Logger logger
           
private static Resource resource
          The Resource singleton
private  java.util.ResourceBundle resourceBundle
          stores the loaded resource bundle
 
Constructor Summary
private Resource()
          Protected constructor for specifying the resource bundle to use
 
Method Summary
static Resource get()
          Returns an instance of a subclass, Override this method
static javax.swing.ImageIcon getIcon(java.lang.String icon)
          Creates an ImageIcon using a buffered image to take advantage of hardware rendering if it is available
static java.awt.Image getImage(java.lang.String icon)
          Creates an Image using the specified file
 javax.swing.KeyStroke getKeyStroke(java.lang.String key)
          Gets a localized keystroke.
static java.util.Locale getLocale()
          Gets the default locale
 char getMnemonic(java.lang.String key)
          Gets a localized string, which is one character long and will be automatically transformed into a character.
 java.lang.String getString(java.lang.String key)
          Gets a localized string
private  void loadBundle()
           
static void setLocale(java.util.Locale l)
          Sets the new default locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resourceBundle

private java.util.ResourceBundle resourceBundle
stores the loaded resource bundle


LOCALE

private static final java.lang.String LOCALE
key for locale preference

See Also:
Constant Field Values

DEFAULT_BUNDLE

private static final java.lang.String DEFAULT_BUNDLE
See Also:
Constant Field Values

logger

private static final java.util.logging.Logger logger

resource

private static final Resource resource
The Resource singleton

Constructor Detail

Resource

private Resource()
Protected constructor for specifying the resource bundle to use

Method Detail

loadBundle

private void loadBundle()

get

public static Resource get()
Returns an instance of a subclass, Override this method

Returns:
An instance of a subclass

getString

public java.lang.String getString(java.lang.String key)
Gets a localized string

Parameters:
key - The key for the localized string
Returns:
The localized string

getMnemonic

public char getMnemonic(java.lang.String key)
Gets a localized string, which is one character long and will be automatically transformed into a character.

Parameters:
key - mnemonic key
Returns:
char for mnemonic

getKeyStroke

public javax.swing.KeyStroke getKeyStroke(java.lang.String key)
Gets a localized keystroke.

Parameters:
key - KeyStroke key
Returns:
localized KeyStroke

getIcon

public static javax.swing.ImageIcon getIcon(java.lang.String icon)
Creates an ImageIcon using a buffered image to take advantage of hardware rendering if it is available

Parameters:
icon - path to icon
Returns:
icon

getImage

public static java.awt.Image getImage(java.lang.String icon)
Creates an Image using the specified file

Parameters:
icon - path to icon
Returns:
new Image

setLocale

public static void setLocale(java.util.Locale l)
Sets the new default locale. This must be called if overridden.

Parameters:
l - The new default locale

getLocale

public static java.util.Locale getLocale()
Gets the default locale

Returns:
The default locale