Best way to implement a selection box from a large number of entries

前端 未结 3 847
猫巷女王i
猫巷女王i 2021-01-20 12:31

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

相关标签:
3条回答
  • 2021-01-20 12:45

    You could take a look at SwingLab's autocomplete feature, it allows you to attach it to a JCombBox, JList or JTextComponent

    0 讨论(0)
  • 2021-01-20 13:03

    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.

    0 讨论(0)
  • 2021-01-20 13:08

    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

    0 讨论(0)
提交回复
热议问题