Package org.moeaframework.util.mvc
Class SelectValueAction<T>
java.lang.Object
javax.swing.AbstractAction
org.moeaframework.util.mvc.LocalizedAction
org.moeaframework.util.mvc.SelectValueAction<T>
- Type Parameters:
T
- the type of the setting
- All Implemented Interfaces:
ActionListener
,Serializable
,Cloneable
,EventListener
,Action
,SettingChangedListener
Action that assigns a fixed value to a setting. GUI components based on this action are typically radio buttons.
This action handles selection, so the components do not need to be placed within a button group.
- See Also:
-
Field Summary
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
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
ConstructorDescriptionSelectValueAction
(String id, Localization localization, Setting<T> setting, T value) Constructs a new action to assign a fixed value. -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
Called when the value of a setting changed.Convenience method to create aJMenuItem
based on this action.Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Constructor Details
-
SelectValueAction
Constructs a new action to assign a fixed value.- Parameters:
id
- the id for localizationlocalization
- the source of localization stringssetting
- the underlying settingvalue
- the fixed value
-
-
Method Details
-
actionPerformed
- Specified by:
actionPerformed
in interfaceActionListener
-
settingChanged
Description copied from interface:SettingChangedListener
Called when the value of a setting changed.- Specified by:
settingChanged
in interfaceSettingChangedListener
- Parameters:
event
- details of the change
-
toMenuItem
Convenience method to create aJMenuItem
based on this action.- Returns:
- the menu item
-