Package megamek.client.ui.preferences
Class JComboBoxPreference
java.lang.Object
megamek.client.ui.preferences.PreferenceElement
megamek.client.ui.preferences.JComboBoxPreference
- All Implemented Interfaces:
ItemListener,EventListener
JComboBoxPreference monitors the selected index of a JComboBox. It sets the saved index when a dialog is loaded and
changes it when it changes.
Call preferences.manage(new JComboBoxPreference(JComboBox)) to use this preference, on a JComboBox that has called setName
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddispose()Cleans the preference resources.intprotected StringgetValue()Gets the current value for the preference.protected voidinitialize(String value) Sets the initial value for the preference.voidvoidsetSelectedIndex(int selectedIndex) Methods inherited from class megamek.client.ui.preferences.PreferenceElement
getName
-
Constructor Details
-
JComboBoxPreference
- Throws:
Exception
-
-
Method Details
-
getWeakReference
-
getSelectedIndex
public int getSelectedIndex() -
setSelectedIndex
public void setSelectedIndex(int selectedIndex) -
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
-
itemStateChanged
- Specified by:
itemStateChangedin interfaceItemListener
-