I am using a JTextField
for auto suggestion, as described in following code
String[] myStrings = new String[] {"Elem1","Elem2","Elem3","Elem4","Elem5"};
JList list = new JList(myStrings); //data has type Object[]
AutoCompleteDecorator.decorate(list, this.customerNameField, ObjectToStringConverter.DEFAULT_IMPLEMENTATION);
Now I can only select the name from myStrings
, but my client want that he can select the value from auto suggestion also he can add other vales but above code is not allowing me to do this.
use AutoComplete JComboBox/JTextField#setStrict(boolean flag)
or search for equivalent in SwingX#enableAutoCompletion(),