|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.bs.mdi.Resources
Manages program resources such as localized strings or icons.
| Field Summary | |
static int |
BUTTON_ICON
|
static int |
CUSTOM_ICON
|
static int |
MENU_ICON
|
static int |
MESSAGEBOX_ICON
|
static int |
TOOLBAR_ICON
|
| Constructor Summary | |
Resources()
Resources is an abstract class and therefore cannot be instantiated. |
|
| Method Summary | |
abstract Icon |
getIcon(String key,
int size)
Returns an icon for the specified key and in the given size |
Locale |
getLocale()
Returns the currently used locale. |
int |
getMnemonic(String key)
Returns the Mnemonic for the given key. |
abstract String |
getString(String key)
Returns a localized string for the given key. |
String |
i18n(String key)
Returns a localized string for the given key, stripping ampersand characters which are meant for marking mnemonics. |
abstract void |
loadResources()
Re-loads the resources from storage. |
void |
setLocale(Locale locale)
Sets the locale used for getting translated/localized resources. |
protected String |
stripMnemonic(String s)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int CUSTOM_ICON
public static final int MENU_ICON
public static final int BUTTON_ICON
public static final int TOOLBAR_ICON
public static final int MESSAGEBOX_ICON
| Constructor Detail |
public Resources()
loadResources().
| Method Detail |
public void setLocale(Locale locale)
locale - the locale to be usedpublic Locale getLocale()
public abstract void loadResources()
getLocale()) into account.
public abstract String getString(String key)
key - the key
public abstract Icon getIcon(String key,
int size)
key - the keysize - the size of the icon: pre-defined values are:
CUSTOM_ICON, MENU_ICON,
BUTTON_ICON, TOOLBAR_ICON,
MESSAGEBOX_ICON.
public String i18n(String key)
getMnemonic(java.lang.String).
key - the key
protected String stripMnemonic(String s)
public int getMnemonic(String key)
Example: For accessing the file menu, the keystroke "F" may be used as the mnemonic of this menu. The letter "F" then usually appears underligned, and the user can press a key combination such as STRG-F or ALT-F for activating the menu.
Using the jmdiframework resource system, mnemonics are usually marked using the prefix "&" (ampersand). In the above example, the file menu label would be saved in the resource files as "&File".
This method first looks for a translation of the given key using the
getString(java.lang.String) method, then scans the result for the appearance
of an ampersand character, and returns the following character as the
mnemonic.
key - the key
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||