com.quadrique.jbuildingblocks.gui
Class ActionBase

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by com.quadrique.jbuildingblocks.gui.ActionBase
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action
Direct Known Subclasses:
ActionBaseToggle, ShortcutsViewAction, TableAction

public abstract class ActionBase
extends AbstractAction

This is the base class for all the GUI actions.

Author:
Hervé Rivere
See Also:
AbstractAction, Action, Serialized Form

Field Summary
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
ActionBase(String zActionName, String zTooltipText, String zIconName)
          constructor
ActionBase(String zActionName, String zTooltipText, String zIconName, int zMnemonic)
          constructor
 
Method Summary
 KeyStroke getAccelerator()
           
 Icon getIcon()
           
 int getMnemonic()
           
 String getName()
           
 String getTooltipText()
           
 void setAccelerator(KeyStroke zKeyStroke)
          to set the accelerator associated to the action.
 void setIcon(Icon zIcon)
          to set the icon associated to the action
 void setMnemonic(int zMnemonic)
          to set the mnemonic associated to the action.
 String toString()
           
 void updateAction()
          this method is provided so that you update the action when all the components of the applications have been created (e.g.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
 

Constructor Detail

ActionBase

public ActionBase(String zActionName,
                  String zTooltipText,
                  String zIconName)
           throws Exception
constructor

Parameters:
zActionName - the name of the action
zTooltipText - the tooltip text to use for this action
zIconName - the name of the icon image file. The file will be loaded with the Resources class
Throws:
Exception - if an error occurs
See Also:
Resources

ActionBase

public ActionBase(String zActionName,
                  String zTooltipText,
                  String zIconName,
                  int zMnemonic)
           throws Exception
constructor

Parameters:
zActionName - the name of the action
zTooltipText - the tooltip text to use for this action
zIconName - the name of the icon image file. The file will be loaded with the Resources class
zMnemonic - the KeyEvent to use as a mnemonic for the action. For instance, "KeyEvent.VK_P" for the letter P.
Throws:
Exception - if an error occurs
See Also:
Resources
Method Detail

setMnemonic

public void setMnemonic(int zMnemonic)
to set the mnemonic associated to the action. For instance, use: "setMnemonic(KeyEvent.VK_P);" to specify P as the mnemonic for the action

Parameters:
zMnemonic - the KeyEvent to use as a mnemonic for the action. For instance, "KeyEvent.VK_P" for the letter P.
See Also:
KeyEvent

getMnemonic

public int getMnemonic()
Returns:
the mnemonic associated to the action KeyEvent.VK_UNDEFINED is used if no menmonic has been associated to the action.

setAccelerator

public void setAccelerator(KeyStroke zKeyStroke)
to set the accelerator associated to the action. For instance, use: "setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,Event.CTRL_MASK));" to specify Control-N as the accelerator for this action.

Parameters:
zKeyStroke - the KeyStroke to use as an accelerator for the action. For instance, "KeyStroke.getKeyStroke(KeyEvent.VK_P,Event.CTRL_MASK);" for Control-P.
See Also:
KeyStroke

getAccelerator

public KeyStroke getAccelerator()
Returns:
the accelerator associated to the action
See Also:
KeyStroke

getIcon

public Icon getIcon()
Returns:
the icon associated to the action (or null)

setIcon

public void setIcon(Icon zIcon)
to set the icon associated to the action

Parameters:
zIcon - the icon to use

getName

public String getName()
Returns:
the name of the action

toString

public String toString()
Overrides:
toString in class Object
Returns:
the name of the action

getTooltipText

public String getTooltipText()
Returns:
the tooltip text for the action

updateAction

public void updateAction()
this method is provided so that you update the action when all the components of the applications have been created (e.g. you might need to register as a listener of a given GUI component...)



Copyright © 2001-2009 Quadrique Corporation. All Rights Reserved.