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 AutoCompletion(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 constrcutors.
One is AutoCompletion(JTextComponent, Searchable) .
It will use Searchable which is another component 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 constrcutor takes any java.util.List and use it as auto completion list.
The only option available on AutoCompletion is 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.
AutoCompletionis 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 AutoCompletion(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. HoweverAutoCompletioncan do more than that. There are two more constrcutors. One is AutoCompletion(JTextComponent, Searchable) . It will use Searchable which is another component 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 constrcutor takes any java.util.List and use it as auto completion list. The only option available onAutoCompletionis 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.