|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--JMenuLoader
Builds up a Swing menu by reading the settings from a resource file. It's intended to use this class for loading menu's created with Magic Menu.
Field Summary | |
static java.lang.String |
ACCEL_SUFFIX
Suffix applied to the key used in resource file lookups for a accelerator. |
static java.lang.String |
ACTION_SUFFIX
Suffix applied to the key used in resource file lookups for an action. |
static java.lang.String |
IMAGE_SUFFIX
Suffix applied to the key used in resource file lookups for an image. |
static java.lang.String |
LABEL_SUFFIX
Suffix applied to the key used in resource file lookups for a label. |
static char |
MNEMONIC_ESCAPE
The escape character to identify a mnemonic in a label. |
static java.lang.String |
TYPE_CHECKBOX
Type identifier of a checkbox menu item. |
static java.lang.String |
TYPE_ITEM
Type identifier of a menu item. |
static java.lang.String |
TYPE_MENU
Type identifier of a submenu. |
static java.lang.String |
TYPE_SUFFIX
Suffix applied to the key used in resource file lookups for the type of a menu item. |
Constructor Summary | |
JMenuLoader(java.util.Properties properties)
Create a new JMenuLoader object. |
|
JMenuLoader(java.util.ResourceBundle resources)
Create a new JMenuLoader object. |
Method Summary | |
(package private) static void |
|
protected javax.swing.JMenu |
createMenu(java.lang.String key)
Create a menu. |
protected javax.swing.JMenuBar |
createMenuBar(java.lang.String key)
Create the menubar for the specified key. |
javax.swing.JMenuItem |
createMenuItem(java.lang.String key)
This is the hook through which all menu items are created. |
protected java.awt.event.ActionListener |
getAction(java.lang.String cmd)
Return the Action with name cmd stored in the command hashtable. |
java.util.Hashtable |
getCommands()
Returns a hashtable containing the menu commands. |
java.awt.event.ActionListener |
getDefaultActionListener()
Return the default action listener. |
protected java.net.URL |
getResource(java.lang.String key)
Read the name of an image from the resource bundle and convert if to an URL. |
protected java.lang.String |
getResourceString(java.lang.String key)
Read a string from the resource bundle containing the menu definition. |
protected javax.swing.ImageIcon |
loadImageIcon(java.net.URL url)
Hook through which ImageIcons are loaded. |
protected void |
reportError(java.lang.String text)
This method will be called, if some errors occur. |
void |
setCommands(java.util.Hashtable commands)
Set the hashtable containing the menu commands. |
void |
setDefaultActionListener(java.awt.event.ActionListener al)
Set the default action listener. |
protected java.lang.String[] |
tokenize(java.lang.String input)
Take the given string and chop it up into a series of strings on whitespace boundries. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final java.lang.String IMAGE_SUFFIX
public static final java.lang.String LABEL_SUFFIX
public static final java.lang.String ACCEL_SUFFIX
public static final java.lang.String ACTION_SUFFIX
public static final java.lang.String TYPE_SUFFIX
public static final java.lang.String TYPE_ITEM
public static final java.lang.String TYPE_MENU
public static final java.lang.String TYPE_CHECKBOX
public static final char MNEMONIC_ESCAPE
Constructor Detail |
public JMenuLoader(java.util.ResourceBundle resources)
resources
- A resources bundle containing the menu settings.public JMenuLoader(java.util.Properties properties)
properties
- Properties containing the menu settings.Method Detail |
static void()
public java.util.Hashtable getCommands()
public void setCommands(java.util.Hashtable commands)
createMenuBar(java.lang.String)
,
createMenu(java.lang.String)
,
createMenuItem(java.lang.String)
public java.awt.event.ActionListener getDefaultActionListener()
public void setDefaultActionListener(java.awt.event.ActionListener al)
createMenuBar(java.lang.String)
,
createMenu(java.lang.String)
,
createMenuItem(java.lang.String)
public javax.swing.JMenuItem createMenuItem(java.lang.String key)
protected java.awt.event.ActionListener getAction(java.lang.String cmd)
cmd
- The action command of the associated menu item.protected java.lang.String getResourceString(java.lang.String key)
protected java.net.URL getResource(java.lang.String key)
Display Images im Menu Items
was selected at creation time of this class.protected java.lang.String[] tokenize(java.lang.String input)
protected javax.swing.JMenuBar createMenuBar(java.lang.String key)
protected javax.swing.JMenu createMenu(java.lang.String key)
protected javax.swing.ImageIcon loadImageIcon(java.net.URL url)
Display Images im Menu Items
was selected at
creation time of this class.protected void reportError(java.lang.String text)
|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |