JComboBox autocomplete

user1872351 picture user1872351 · Dec 3, 2012 · Viewed 44.6k times · Source

How do I perform auto-complete in editable JComboBox in Netbeans 7.1 like in ComboBox in VB dot net. I have a combo box with a list binding, I want to select item by typing only some first letter of the item in the list for example if a list has kitten, then it should be chosen when I type ki.

Answer

Robin picture Robin · Dec 3, 2012

If you want to do this yourself, you can follow the steps explained in this article.

this.comboBox = new JComboBox(new Object[] { "Ester", "Jordi",
        "Jordina", "Jorge", "Sergi" });
AutoCompleteDecorator.decorate(this.comboBox);