|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--JToolBarLoader
Builds up a Swing toolbar by reading the settings from a resource file. It's intended to use this class for loading toolbar's created with Magic Menu.
Field Summary | |
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 int |
STRUT_SIZE
The distance between separated toolbar components. |
static java.lang.String |
TOOLTIP_SUFFIX
Suffix applied to the key used in resource file lookups for a tooltip. |
Constructor Summary | |
JToolBarLoader(java.util.Properties properties)
Create a new JToolBarLoader object. |
|
JToolBarLoader(java.util.ResourceBundle resources)
Create a new JToolBarLoader object. |
Method Summary | |
protected java.awt.Component |
createTool(java.lang.String key)
Hook through which every toolbar item is created. |
javax.swing.JToolBar |
createToolBar(java.lang.String key)
Create the toolbar for the specified key. |
protected javax.swing.JButton |
createToolBarButton(java.lang.String key)
Create a button to go inside of the toolbar. |
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 toolbar 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 file containing the toolbar 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 toolbar 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 |
|
Field Detail |
public static final java.lang.String IMAGE_SUFFIX
public static final java.lang.String LABEL_SUFFIX
public static final java.lang.String ACTION_SUFFIX
public static final java.lang.String TOOLTIP_SUFFIX
public static final char MNEMONIC_ESCAPE
public static final int STRUT_SIZE
Constructor Detail |
public JToolBarLoader(java.util.ResourceBundle resources)
resources
- A resources bundle containing the toolbar settings.public JToolBarLoader(java.util.Properties properties)
properties
- Properties containing the menu settings.Method Detail |
public java.util.Hashtable getCommands()
public void setCommands(java.util.Hashtable commands)
createToolBar(java.lang.String)
,
createTool(java.lang.String)
,
createToolBarButton(java.lang.String)
public java.awt.event.ActionListener getDefaultActionListener()
public void setDefaultActionListener(java.awt.event.ActionListener al)
createToolBar(java.lang.String)
,
createTool(java.lang.String)
,
createToolBarButton(java.lang.String)
protected javax.swing.JButton createToolBarButton(java.lang.String key)
key
- The key in the resource file to serve as the basis
of lookups.protected java.awt.event.ActionListener getAction(java.lang.String cmd)
cmd
- The action command of the associated toolbar button.protected java.lang.String getResourceString(java.lang.String key)
protected java.net.URL getResource(java.lang.String key)
protected java.lang.String[] tokenize(java.lang.String input)
public javax.swing.JToolBar createToolBar(java.lang.String key)
protected java.awt.Component createTool(java.lang.String key)
protected javax.swing.ImageIcon loadImageIcon(java.net.URL url)
protected void reportError(java.lang.String text)
|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |