I have a large set of data from which the user has to select one. I\'m thinking of a way to implement it (of course, in a GUI). I have a few ideas. But just thought of posti
You could take a look at SwingLab's autocomplete feature, it allows you to attach it to a JCombBox
, JList
or JTextComponent
Autocomplete is what you are probably looking for. Google for "java swing jcombobox autocomplete" and limit results for the last couple of years to get relevant results. There will be a lot of examples and ideas on how to implement this with custom code.
I believe there is also some custom libraries like "swingx" that provide at least partial or full implementations to save time.
http://swingx.java.net/
They have released code as recently as the beginning of this years so it appears active and might have what you need.
use AutoComplete JComboBox/JTextField
based on Standard Java Classes
no issue with larger sets of data
no issue with Focus
, BackSpace Key
, Caret
for better performance to required sort the array
before use
simple workaround for setStrict(true/false)
, restrict input to array