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

坚强是说给别人听的谎言 提交于 2019-12-01 22:07:00

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.

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

mKorbel

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!