JComboBox 自动完成 [英] JComboBox autocomplete

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

问题描述

如何在 Netbeans 7.1 中的可编辑 JComboBox 中执行自动完成,如 VB dot net 中的 ComboBox.我有一个带有列表绑定的组合框,我想通过只输入列表中项目的第一个字母来选择项目,例如如果列表有 kitten,那么当我输入时应该选择它ki.

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.

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

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

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