Reputation: 473
How to have auto complete JCombobox so, that it should suggest an item which have typed word or phrase in it anywhere in the string not just starting with that string. I'm using eclipse juno IDE and solution should be JDK 1.5 supported
Upvotes: 1
Views: 293
Reputation: 9307
You can implement your own KeySelectionManager which will be invoked when any key is typed. Default behavior is to select entry that starts with given character but you can modify it to get the current text from the text field component in the jcombo box and then select the matching entry.
You will need to look at following method in detail:
javax.swing.JComboBox.setKeySelectionManager(KeySelectionManager)
Upvotes: 1