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() ,
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.