我怎么能使用的Swing实现自动完成? [英] How could I implement autocompletion using Swing?

查看:121
本文介绍了我怎么能使用的Swing实现自动完成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有兴趣在一个JFrame提供自动完成框。触发机制将基于助记符(我认为),但我真的不知道用什么为自动完成盒子(我想结果被过滤为用户presses键)。

I'm interested in providing an autocompletion box in a JFrame. The triggering mechanism will be based on mnemonics (I think), but I'm not really sure what to use for the "autocompletion box" (I would like results to be filtered as the user presses keys).

你将如何实现这一点?一些JFrame的,或JPopupMenu的?

How would you implement this? Some sort of JFrame, or a JPopupMenu?

我想知道这是如何实现的,所以请不要发布链接可用[J]组件。

I would like to know how this is implemented, so please don't post links to available [J]Components.

推荐答案

有是在
Sun的教程使用Swing组件

There is an example for auto-completion for text area at
Sun's tutorials "Using Swing Components".

它在文字处理器(没有弹出窗口的方式进行的,但

建议的文本键入提前光标)。

It is done in the style of word processors (no pop ups, but the
suggested text is typed ahead of the cursor).

只是向下滚动到又如:TextAreaDemo

蚂蚁击中发射按钮!

Just scroll down to "Another Example: TextAreaDemo"
ant hit the Launch button!

这篇关于我怎么能使用的Swing实现自动完成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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