Skip to main content

JComboBox filterable with matching items

No replies
kevin_louis
Offline
Joined: 2008-05-23
Points: 0

Hi guys,

I am implementing a feature with capabilites of filtering strings in JComboBox which is based on the following:
1) show the string when inserting a non-matching string
2) show the popup list when inserting a matching string
3) as with 2), the popup list changes when matching string text changes,
and will remain the string text if no matching item found, meantime, no popup
list showing
4) can select one item from the popup list and place it in the JComboBox text
field
5) can select from the initial list when the string text is empty just like make a
selection from the initial list at the beginning.

But I come accorss some issues which are "no initial list when there is no matching item found", "cannot get the initial list after removing the string text as having found the filterable popup list" and "the non-matching string text cannot been inserted once the first char is not matched in the initial list".

Can anyone give a working code sample?
Thanks in advance.

Kevin