Netbeans swing文本字段提示列表

Netbeans swing文本字段提示列表,swing,netbeans,Swing,Netbeans,我想根据输入内容(比如谷歌搜索)创建带有提示的文本字段。是否有可能使用文本字段进行此操作?如果是这样的话,我该怎么做呢?如果您指的是自动完成(您必须使用JComboBox): 最简单的方法是使用库 例如: JComboBox combobox = new JComboBox(new Object[] { "One", "Two", "Three", "Four", "Five" }); AutoCompleteDecorator.decorate(comboBox); combo

我想根据输入内容(比如谷歌搜索)创建带有提示的文本字段。是否有可能使用文本字段进行此操作?如果是这样的话,我该怎么做呢?

如果您指的是自动完成(您必须使用JComboBox):

最简单的方法是使用库

例如:

JComboBox combobox = new JComboBox(new Object[] { "One", "Two",
        "Three", "Four", "Five" });
AutoCompleteDecorator.decorate(comboBox);
combobox.setEditable(true);
如果你想自己做,请阅读