public class MenuActionFactory extends java.lang.Object implements MenuItemFactory
Red (johnr) |
Red (eal) |
Constructor and Description |
---|
MenuActionFactory(javax.swing.Action action)
Construct a factory that adds a given action to a given context menu.
|
MenuActionFactory(javax.swing.Action[] actions,
java.lang.String label)
Construct a factory that adds a given group of actions
to a given context menu in a submenu with the specified label.
|
Modifier and Type | Method and Description |
---|---|
protected javax.swing.JMenuItem |
_add(JContextMenu menu,
javax.swing.Action action,
java.lang.String tooltip)
Add an action to the context menu.
|
protected javax.swing.JMenuItem |
_add(javax.swing.JMenu submenu,
javax.swing.Action action)
Add an action to the submenu.
|
void |
addAction(javax.swing.Action action)
Add an action to the pre-existing group of actions.
|
void |
addAction(javax.swing.Action action,
java.lang.String label)
Add an action to the pre-existing group of actions.
|
void |
addActions(javax.swing.Action[] actions,
java.lang.String label)
Add a set of action to the pre-existing group of actions.
|
void |
addMenuItemListener(MenuItemListener listener)
Add a menu item listener to the list of menu item listeners.
|
javax.swing.JMenuItem |
create(JContextMenu menu,
NamedObj object)
Add an item to the given context menu that will configure the
parameters on the given target.
|
boolean |
substitute(javax.swing.Action oldAction,
javax.swing.Action newAction)
Substitute the old action with the new action, if the old action is
added to this factory.
|
public MenuActionFactory(javax.swing.Action action)
action
- The action to be associated with the context menu.public MenuActionFactory(javax.swing.Action[] actions, java.lang.String label)
actions
- The actions to be in the submenu.label
- The label for the submenu.public void addAction(javax.swing.Action action)
action
- The action to add.public void addAction(javax.swing.Action action, java.lang.String label)
action
- The action to add.label
- The label to give to the menu group.public void addActions(javax.swing.Action[] actions, java.lang.String label)
actions
- The actions to add.label
- The label to give to the menu group if it
previously not a menu group.public void addMenuItemListener(MenuItemListener listener)
listener
- The menu item listener.public javax.swing.JMenuItem create(JContextMenu menu, NamedObj object)
create
in interface MenuItemFactory
menu
- The context menu to add to.object
- The object that the menu item command will operate on.public boolean substitute(javax.swing.Action oldAction, javax.swing.Action newAction)
oldAction
- The old action.newAction
- The new action.protected javax.swing.JMenuItem _add(JContextMenu menu, javax.swing.Action action, java.lang.String tooltip)
menu
- The context menu.action
- The action to be added to the context menu.tooltip
- The tooltip for the action.protected javax.swing.JMenuItem _add(javax.swing.JMenu submenu, javax.swing.Action action)
submenu
- The submenu.action
- The action to be added to the submenu.