Package org.moeaframework.util.mvc
Class PopupAction
java.lang.Object
javax.swing.AbstractAction
org.moeaframework.util.mvc.LocalizedAction
org.moeaframework.util.mvc.PopupAction
- All Implemented Interfaces:
ActionListener,Serializable,Cloneable,EventListener,Action
Action that displays a popup menu when triggered. GUI components based on this action are typically buttons, with
the menu displayed adjacent to the button.
- See Also:
-
Field Summary
Fields 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
ConstructorsConstructorDescriptionPopupAction(String id, Localization localization, Supplier<JPopupMenu> menuSupplier) Constructs a new popup action. -
Method Summary
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Constructor Details
-
PopupAction
Constructs a new popup action.- Parameters:
id- the id for localizationlocalization- the source for localization stringsmenuSupplier- callback that generates the menu
-
-
Method Details
-
actionPerformed
-
toButton
Convenience method to create aJButtonbased on this action.- Returns:
- the menu item
-