开发者

How to add suggestion list to JEditorPane

How to add suggestion list ( when user type part of some word to suggest list of all tokens which 开发者_如何学编程starts with that part, something like intellisense in Eclipse ) to JEditorPane ? I have implemented method which returns ArrayList of strings but how to show that ?


add them to a JList and show the list in a JPopupMenu


javax.swing.JPopupMenu may help u...

for every keyReleasedEvent pass the substring to your method..

for each suggested string javax.swing.AbstractAction should be created..

I hope it helps...


I would advise you to use the open source Jide common layer, particularly the AutoCompletion helper class.

How to add suggestion list to JEditorPane

How to add suggestion list to JEditorPane

It works with a lot of swing components, with or without a list of possibilities being shown. Highly recommended.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜