Java Tutorial/Intermediate GUIs/Textfield with text completion

The CompletionTextField combines use of Listeners, Threads, TreeSets, Comparators and Events to create a subclass of that allows text completion. When the JComboBox shows its popup list every key press reduces the list of available choices to the list that starts with the given prefix.

CompletionTextField contains the following inner classes:
 * StringItem — an item that can be shown in the completion list
 * CompletionComboBoxModel — the ComoboBoxModel for the completion list
 * ItemComparator — a comparator that can be used for a TreeSet
 * Selection — a range of selected indices
 * CompletionComboBoxEditor — an editor for text editing in the ComboBox
 * CompletionKeyAdapter — an adapter class for receiving key events

CompletionTextField source
(source code from vsrs.svn.sourceforge.net)