Package megamek.client.ui.preferences
Class JToggleButtonPreference
java.lang.Object
megamek.client.ui.preferences.PreferenceElement
megamek.client.ui.preferences.JToggleButtonPreference
- All Implemented Interfaces:
EventListener,ChangeListener
JTextFieldPreference monitors the selected state of a JToggleButton (which JCheckbox extends). It sets the saved
value when a dialog is loaded and changes it as it changes.
Call preferences.manage(new JToggleButtonPreference(JToggleButton)) to use this preference, on a JToggleButton that has called setName
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddispose()Cleans the preference resources.protected StringgetValue()Gets the current value for the preference.protected voidinitialize(String value) Sets the initial value for the preference.booleanvoidsetSelected(boolean selected) voidstateChanged(ChangeEvent evt) Methods inherited from class megamek.client.ui.preferences.PreferenceElement
getName
-
Constructor Details
-
JToggleButtonPreference
- Throws:
Exception
-
-
Method Details
-
getWeakReference
-
isSelected
public boolean isSelected() -
setSelected
public void setSelected(boolean selected) -
getValue
Description copied from class:PreferenceElementGets the current value for the preference.- Specified by:
getValuein classPreferenceElement- Returns:
- the value of the preference.
-
initialize
Description copied from class:PreferenceElementSets the initial value for the preference.- Specified by:
initializein classPreferenceElement- Parameters:
value- initial value.- Throws:
Exception- if there's an error during initialization
-
dispose
protected void dispose()Description copied from class:PreferenceElementCleans the preference resources.- Specified by:
disposein classPreferenceElement
-
stateChanged
- Specified by:
stateChangedin interfaceChangeListener
-