AutoCompletion
is a helper class to make JTextComponent or JComboBox auto-complete based on a list of known items.
There are three constructors. The simplest one is {@link #AutoCompletion(javax.swing.JComboBox)}. It takes any combobox and make it auto completion. If you are looking for an auto-complete combobox solution, this is all you need. However
AutoCompletion
can do more than that. There are two more constructors. One is {@link #AutoCompletion(javax.swing.text.JTextComponent,Searchable)}. It will use {@link Searchable} which is anothercomponent available in JIDE to make the JTextCompoent auto-complete. We used Searchable here because it provides a common interface to access the element in JTree, JList or JTable. In the other word, the known list item we used to auto-complete can be got from JTree or JList or even JTable or any other component as long as it has Searchable interface implemented. The last constructor takes any java.util.List and use it as auto completion list.
The only option available on
AutoCompletion
is {@link #setStrict(boolean)}. If it's true, it will not allow user to type in anything that is not in the known item list. If false, user can type in whatever he/she wants. If the text can match with a item in the known item list, it will still auto-complete.
@author Thomas Bierhance
@author JIDE Software, Inc.