Package org.jdesktop.swingx.autocomplete
Class AutoCompleteComboBoxEditor
java.lang.Object
org.jdesktop.swingx.autocomplete.AutoCompleteComboBoxEditor
- All Implemented Interfaces:
ComboBoxEditor
Wrapper around the combobox editor that translates combobox items into strings. The methods setItem and getItem are modified to account for the string conversion.
This is necessary for those cases where the combobox items have no useful toString() method and a custom ObjectToStringConverter is used.
If we do not do this, the interaction between ComboBoxEditor and JComboBox will result in firing ActionListener events with the string value of ComboBoxEditor as the currently selected value.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Object
last selected item(package private) final ObjectToStringConverter
the converter used to convert items into their string representation(package private) final ComboBoxEditor
the original combo box editor -
Constructor Summary
ConstructorsConstructorDescriptionAutoCompleteComboBoxEditor
(ComboBoxEditor wrapped, ObjectToStringConverter stringConverter) Creates a new AutoCompleteComboBoxEditor. -
Method Summary
-
Field Details
-
wrapped
the original combo box editor -
stringConverter
the converter used to convert items into their string representation -
oldItem
last selected item
-
-
Constructor Details
-
AutoCompleteComboBoxEditor
Creates a new AutoCompleteComboBoxEditor.- Parameters:
wrapped
- the original ComboBoxEditor to be wrappedstringConverter
- the converter to use to convert items into their string representation.
-
-
Method Details
-
getEditorComponent
- Specified by:
getEditorComponent
in interfaceComboBoxEditor
-
setItem
- Specified by:
setItem
in interfaceComboBoxEditor
-
getItem
- Specified by:
getItem
in interfaceComboBoxEditor
-
selectAll
public void selectAll()- Specified by:
selectAll
in interfaceComboBoxEditor
-
addActionListener
- Specified by:
addActionListener
in interfaceComboBoxEditor
-
removeActionListener
- Specified by:
removeActionListener
in interfaceComboBoxEditor
-