AutoCompleteComboBoxEditor acEditor = (AutoCompleteComboBoxEditor) evt.getOldValue();
boolean strictMatching = false;
if (acEditor.getEditorComponent() != null) {
JTextComponent textComponent = (JTextComponent) acEditor.getEditorComponent();
strictMatching = ((AutoCompleteDocument) textComponent.getDocument()).strictMatching;
undecorate(textComponent);
for (KeyListener l : textComponent.getKeyListeners()) {
if (l instanceof KeyAdapter) {
textComponent.removeKeyListener(l);
break;
}
}
}
JTextComponent editorComponent = (JTextComponent) comboBox.getEditor().getEditorComponent();
AbstractAutoCompleteAdaptor adaptor = new ComboBoxAdaptor(comboBox);
AutoCompleteDocument document = createAutoCompleteDocument(adaptor, strictMatching,
acEditor.stringConverter, editorComponent.getDocument());
decorate(editorComponent, document, adaptor);
editorComponent.addKeyListener(new AutoComplete.KeyAdapter(comboBox));
//set before adding the listener for the editor
comboBox.setEditor(new AutoCompleteComboBoxEditor(comboBox.getEditor(), document.stringConverter));
}