Package megamek.client.ui.models
Class FileNameComboBoxModel
java.lang.Object
megamek.client.ui.models.FileNameComboBoxModel
- All Implemented Interfaces:
ComboBoxModel<String>,ListModel<String>
The FileNameComboBoxModel class is a ComboBoxModel that uses the file name as the value. It receives a list or array
of files and instead of showing the string version of the file it shows only the value of
File.getName()
method. It has a helper function to get the selected file on its own if necessary.-
Constructor Summary
ConstructorsConstructorDescriptionFileNameComboBoxModel(File[] files) FileNameComboBoxModel(List<File> files) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionvoidgetElementAt(int index) Returns the file name of the file at the given index.intgetSize()voidvoidsetSelectedItem(Object anItem)
-
Constructor Details
-
FileNameComboBoxModel
Deprecated, for removal: This API element is subject to removal in a future version. -
FileNameComboBoxModel
-
-
Method Details
-
setSelectedItem
- Specified by:
setSelectedItemin interfaceComboBoxModel<String>
-
getSelectedItem
- Specified by:
getSelectedItemin interfaceComboBoxModel<String>
-
getSize
public int getSize() -
getElementAt
Returns the file name of the file at the given index.- Specified by:
getElementAtin interfaceListModel<String>- Parameters:
index- the requested index- Returns:
- the file name of the file at the given index, or
nullif the index is out of bounds or there is no element at the given index.
-
addListDataListener
- Specified by:
addListDataListenerin interfaceListModel<String>
-
removeListDataListener
- Specified by:
removeListDataListenerin interfaceListModel<String>
-
getSelectedFile
-