Damir
Damir

Reputation: 56229

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 ?

Upvotes: 2

Views: 501

Answers (3)

I82Much
I82Much

Reputation: 27326

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

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

Upvotes: 1

Abhilash
Abhilash

Reputation: 458

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...

Upvotes: 1

kleopatra
kleopatra

Reputation: 51535

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

Upvotes: 1

Related Questions