org.jfree.report.modules.gui.swing.common.action

Class ActionMenuItem

public class ActionMenuItem extends JMenuItem

The ActionMenuItem is used to connect an Action and its properties to an MenuItem.

This functionality is already implemented in JDK 1.3 but needed for JDK 1.2.2 compatibility.

Author: Thomas Morgner

Constructor Summary
ActionMenuItem()
Default constructor.
ActionMenuItem(Icon icon)
Creates a menu item with the specified icon.
ActionMenuItem(String text)
Creates a menu item with the specified label.
ActionMenuItem(String text, Icon icon)
Creates a menu item with the specified label and icon.
ActionMenuItem(String text, int i)
Creates a new menu item with the specified label and mnemonic.
ActionMenuItem(Action action)
Creates a new menu item based on the specified action.
Method Summary
ActiongetAction()
Returns the assigned action or null if no action has been assigned.
voidsetAction(Action newAction)
Assigns the given action to this menuitem.
voidsetEnabled(boolean b)
Enables and disables this button and if an action is assigned to this menuitem the propertychange is forwarded to the assigned action.

Constructor Detail

ActionMenuItem

public ActionMenuItem()
Default constructor.

ActionMenuItem

public ActionMenuItem(Icon icon)
Creates a menu item with the specified icon.

Parameters: icon the icon.

ActionMenuItem

public ActionMenuItem(String text)
Creates a menu item with the specified label.

Parameters: text the label.

ActionMenuItem

public ActionMenuItem(String text, Icon icon)
Creates a menu item with the specified label and icon.

Parameters: text the label. icon the icon.

ActionMenuItem

public ActionMenuItem(String text, int i)
Creates a new menu item with the specified label and mnemonic.

Parameters: text the label. i the mnemonic.

ActionMenuItem

public ActionMenuItem(Action action)
Creates a new menu item based on the specified action.

Parameters: action the action.

Method Detail

getAction

public Action getAction()
Returns the assigned action or null if no action has been assigned.

Returns: the action.

setAction

public void setAction(Action newAction)
Assigns the given action to this menuitem. The properties of the action will be assigned to the menuitem. If an previous action was set, the old action is unregistered.

Parameters: newAction the new action

setEnabled

public void setEnabled(boolean b)
Enables and disables this button and if an action is assigned to this menuitem the propertychange is forwarded to the assigned action.

Parameters: b the new enable-state of this menuitem