JComboBox中自动完成 [英] JComboBox autocomplete

查看:219
本文介绍了JComboBox中自动完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么样在组合框在VB点网进行自动完成的编辑的JComboBox 中的Netbeans 7.1。我有一个列表的组合框的结合,我想通过在列表中,例如只键入项目的一些首字母如果列表有小猫,然后选择项目当我输入的选择应

How do I perform auto-complete in editable JComboBox in Netbeans 7.1 like in ComboBox in VB dot net. I have a combo box with a list binding, I want to select item by typing only some first letter of the item in the list for example if a list has kitten, then it should be chosen when I type ki.

推荐答案

如果你想自己做,你可以按照步骤的这篇文章

If you want to do this yourself, you can follow the steps explained in this article.

如果您不希望推倒重来,您可以使用现有届党lib中添加此功能在<一个解释href=\"http://today.java.net/pub/a/today/2007/07/19/adding-auto-completion-to-swing-comboboxes.html\">this文章。例如使用SwingX库(例如从链接文章复制):

If you do not want to reinvent the wheel, you can use an existing 3th party lib to add this functionality as explained in this article. For example using the SwingX library (example copied from the linked article):

this.comboBox = new JComboBox(new Object[] { "Ester", "Jordi",
        "Jordina", "Jorge", "Sergi" });
AutoCompleteDecorator.decorate(this.comboBox);

这篇关于JComboBox中自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆