Package megamek.client.ui.preferences
Class JListPreference
java.lang.Object
megamek.client.ui.preferences.PreferenceElement
megamek.client.ui.preferences.JListPreference
- All Implemented Interfaces:
PropertyChangeListener,EventListener
JListPreference monitors the selected indices of a
JList. It sets the saved indices when a dialog is loaded
and changes them when they change.
Call preferences.manage(new JListPreference(JList)) to use this preference, on a JList that has called setName
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddispose()Cleans the preference resources.int[]protected StringgetValue()Gets the current value for the preference.WeakReference<JList<?>> protected voidinitialize(String value) Sets the initial value for the preference.voidvoidsetSelectedIndices(int... selectedIndices) Methods inherited from class megamek.client.ui.preferences.PreferenceElement
getName
-
Constructor Details
-
JListPreference
- Throws:
Exception
-
-
Method Details
-
getWeakReference
-
getSelectedIndices
public int[] getSelectedIndices() -
setSelectedIndices
public void setSelectedIndices(int... selectedIndices) -
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
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-