Search code examples
javaswingautocompletejtextfieldswingx

Autocomplete and editable JTextField using AutoCompleteDecorator


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.


Solution