Package com.nomagic.actions
Class MenuAction
java.lang.Object
javax.swing.AbstractAction
com.nomagic.actions.NMAction
com.nomagic.actions.ActionsCategory
com.nomagic.actions.MenuAction
- All Implemented Interfaces:
 ActionListener,Serializable,Cloneable,Comparable,EventListener,Action,MenuListener,PopupMenuListener
- Direct Known Subclasses:
 MDMenuAction
@OpenApiAll
public class MenuAction
extends ActionsCategory
implements PopupMenuListener, MenuListener
This class represents special kind of action.
 It can behave as normal actions category, but has methods which informs
 action about menu created from this action selecting /deselecting.
- See Also:
 
- 
Field Summary
Fields inherited from class com.nomagic.actions.ActionsCategory
ACTIONS_PROPERTY, ADDED_ACTION_PROPERTY, CHANGE_ACTIONS_PROPERTY, DISABLE_IF_EMPTY, MAX_CATEGORY_ACTIONS, REMOVE_IF_EMPTY, REMOVED_ACTION_PROPERTY, USE_AS_SEPARATOR_IN_UIFields inherited from class com.nomagic.actions.NMAction
ACTION_SHORTCUTS, BELONGS_TO_SEPARATE_GROUP_IN_UI, DO_NO_SHOW_ACTION_NAME_IN_UI, DO_NOT_REGISTER_ACTION_TO_COMPONENTS, GENERATED_ID_PREFIX, GROUP, ID, LARGE_ICON, MENU_SHORTCUT_MASK, TINY_ICONFields inherited from class javax.swing.AbstractAction
changeSupport, enabledFields 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
ConstructorsConstructorDescriptionMenuAction(String id, String name) Construct a menu action with id and nameMenuAction(String id, String name, int keyCode) Creates menu action with given id, name, and key code.MenuAction(String id, String name, int keyCode, String group) Creates menu action with given id, name, and key code.MenuAction(String id, String name, KeyStroke stroke) Creates menu action with given id, name, and KeyStroke.MenuAction(String id, String name, KeyStroke stroke, String group) Creates menu action with given id, name, and KeyStroke. - 
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidInvoked when a menu is selected.voidvoidvoidMethods inherited from class com.nomagic.actions.ActionsCategory
accept, actionPerformed, addAction, addAction, addActionNearTheGiven, addActions, breakActions, breakActions, breakActions, breakeActions, clone, createSeparatorCategory, forEach, forEachIncludingSelf, getAction, getActions, getActionsRecursively, getCategories, isDisplayHeader, isEmpty, isNested, isUseActionForDisable, removeAction, removeIf, setActions, setDisplayHeader, setNested, setUseActionForDisable, shallowClone, size, sortMethods inherited from class com.nomagic.actions.NMAction
addPropertyChangeListener, addShortcut, addShotcut, addWeakPropertyChangeListener, compareTo, createMenuItem, equals, firePropertyChange, getCommandKey, getDescription, getGroup, getIcon, getID, getLargeIcon, getLargeOrSmallIcon, getMenuShortcutMaskAsString, getMnemonicKey, getName, getPropertyChangeListeners, getShortcuts, getSmallIcon, getSmallOrLargeIcon, getTinyIcon, hashCode, hasMenuShortcutMask, isIDGenerated, removePropertyChangeListener, removeShortcut, removeWeakPropertyChangeListener, setDescription, setGroup, setIcon, setLargeIcon, setMnemonicKey, setName, setShortcuts, setSmallIcon, setTinyIcon, toString, updateStateMethods inherited from class javax.swing.AbstractAction
getKeys, getValue, isEnabled, putValue, setEnabled 
- 
Constructor Details
- 
MenuAction
Construct a menu action with id and name- Parameters:
 id- the id of the category.name- the name of the category.
 - 
MenuAction
public MenuAction(@CheckForNull String id, @CheckForNull String name, @CheckForNull KeyStroke stroke) Creates menu action with given id, name, and KeyStroke.- Parameters:
 id- the id of the category.name- the name of the category.stroke- key stroke used for invoking action category.
 - 
MenuAction
public MenuAction(@CheckForNull String id, @CheckForNull String name, @CheckForNull KeyStroke stroke, @CheckForNull String group) Creates menu action with given id, name, and KeyStroke.- Parameters:
 id- the id of the category.name- the name of the category.stroke- key stroke used for invoking action category.group- the name of the related commands group.
 - 
MenuAction
Creates menu action with given id, name, and key code.- Parameters:
 id- the id of the category.name- the name of the category.keyCode- key stroke used for invoking action category.
 - 
MenuAction
Creates menu action with given id, name, and key code.- Parameters:
 id- the id of the category.name- the name of the category.keyCode- key stroke used for invoking action category.group- the name of the related commands group.
 
 - 
 - 
Method Details
- 
popupMenuWillBecomeVisible
- Specified by:
 popupMenuWillBecomeVisiblein interfacePopupMenuListener
 - 
popupMenuWillBecomeInvisible
- Specified by:
 popupMenuWillBecomeInvisiblein interfacePopupMenuListener
 - 
popupMenuCanceled
- Specified by:
 popupMenuCanceledin interfacePopupMenuListener