public class Resources
extends java.lang.Object
The format of the files are 'key=value'.
Integers are one or more digits
Booleans are one y,n,yes,no,t,f,true,false,on,off in any case.
Colors are
#RRGGBB or #AARRGGBB (Alpha pixels specification)
A standard AWT name such as 'yellow'
A Swing UI name such as "Label.foreground"
Sizes are
NNNxMMM
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BUTTON_LABEL_CANCEL
The Cancel button label
|
static java.lang.String |
BUTTON_LABEL_OK
The OK button label
|
Constructor and Description |
---|
Resources() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
formatSingleValue(java.lang.String key,
java.lang.Object value)
Format single value in a message of the form xxxx {0} yyyyy
|
static boolean |
getBoolean(java.lang.String key)
Returns the value of a boolean using false if one not found
|
static boolean |
getBoolean(java.lang.String key,
boolean def)
Returns the value of a boolean using a default if no value found
|
static java.awt.Color |
getColor(java.lang.String key)
Gets a color from a key
|
static java.awt.Color |
getColor(java.lang.String key,
java.awt.Color def)
Gets a color from a key
|
static java.awt.Cursor |
getCursor(java.lang.String key)
Gets a cursor from a key.
|
static java.awt.Cursor |
getCursor(java.lang.String key,
java.awt.Cursor def)
Gets a cursor from a key
|
static java.awt.Dimension |
getDimension(java.lang.String key)
Returns the value of a dimension field
|
static java.awt.Dimension |
getDimension(java.lang.String key,
java.awt.Dimension def)
Returns the value of a dimension field using a default if no value found
|
static javax.swing.Icon |
getDisabledIcon(java.lang.String key)
This method returns the disabled version of an icon using an identifier.
|
static java.awt.Font |
getFont(java.lang.String key)
Gets a font from a key
|
static java.awt.Font |
getFont(java.lang.String key,
int size)
Gets a font from a key
|
static java.awt.Font |
getFont(java.lang.String key,
int size,
java.awt.Font def)
Gets a font from a key
|
static javax.swing.Icon |
getIcon(java.lang.String key)
This method returns an icon using an identifier.
|
static java.io.InputStream |
getInputStream(java.lang.String key)
Gets the input stream corresponding to a key.
|
static int |
getInt(java.lang.String key)
Returns the value of an int.
|
static int |
getInt(java.lang.String key,
int def)
Returns the value of an int using a default if no value found
|
static javax.swing.KeyStroke |
getKeyStroke(java.lang.String key)
Gets a keystroke from a key
|
static java.lang.String |
getLabelString(java.lang.String key)
Returns the value of a string.
|
static java.lang.String |
getString(java.lang.String key)
Returns the value of a string.
|
static java.lang.String |
getString(java.lang.String key,
java.lang.String def)
Returns the value of a string using a default if no value found
|
static void |
initialize()
Initialize with the standard properties file
|
static void |
initialize(java.lang.String name)
Initialize with a properties file
|
static void |
setResources(java.util.PropertyResourceBundle resources)
Sets the resource bundle
|
public static final java.lang.String BUTTON_LABEL_OK
public static final java.lang.String BUTTON_LABEL_CANCEL
public static java.lang.String getLabelString(java.lang.String key)
key
- The key to look uppublic static java.lang.String getString(java.lang.String key)
key
- The key to look uppublic static java.lang.String getString(java.lang.String key, java.lang.String def)
key
- The key to look updef
- The default valuepublic static int getInt(java.lang.String key)
key
- The key to look uppublic static int getInt(java.lang.String key, int def)
key
- The key to look updef
- The default valuepublic static boolean getBoolean(java.lang.String key)
key
- The key to look uppublic static boolean getBoolean(java.lang.String key, boolean def)
key
- The key to look updef
- The default valuepublic static java.awt.Dimension getDimension(java.lang.String key)
key
- The key to look uppublic static java.awt.Dimension getDimension(java.lang.String key, java.awt.Dimension def)
key
- The key to look updef
- The default valuepublic static java.awt.Color getColor(java.lang.String key)
key
- The key to colorpublic static java.awt.Color getColor(java.lang.String key, java.awt.Color def)
key
- The key to colordef
- The default valuepublic static java.awt.Font getFont(java.lang.String key) throws java.lang.Exception
key
- The key to the fontjava.lang.Exception
public static java.awt.Font getFont(java.lang.String key, int size) throws java.lang.Exception
key
- The key to the fontsize
- The size (-1) means use the defined sizejava.lang.Exception
public static java.awt.Font getFont(java.lang.String key, int size, java.awt.Font def) throws java.lang.Exception
key
- The key to the fontsize
- The size (-1) means use the defined sizedef
- The default to usejava.lang.Exception
public static javax.swing.Icon getIcon(java.lang.String key)
id
- The icon identifierpublic static javax.swing.Icon getDisabledIcon(java.lang.String key)
id
- The icon identifierpublic static java.awt.Cursor getCursor(java.lang.String key)
key
- The key to the gif image for the cursorpublic static java.awt.Cursor getCursor(java.lang.String key, java.awt.Cursor def)
key
- The key to the gif image for the cursordef
- The default valuepublic static javax.swing.KeyStroke getKeyStroke(java.lang.String key)
key
- The key to retrievepublic static java.io.InputStream getInputStream(java.lang.String key)
key
- The key to the resourcespublic static void setResources(java.util.PropertyResourceBundle resources)
resources
- The resource bundlepublic static java.lang.String formatSingleValue(java.lang.String key, java.lang.Object value)
key
- Key to the format stringvalue
- The value formatpublic static void initialize()
name
- The property filepublic static void initialize(java.lang.String name)
name
- The property file