• Post Reply Bookmark Topic Watch Topic
  • New Topic

Autocomplete implementation problem

 
Simeon Cherniy
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!

Autocomplete means the panel in which we could select the word to end the current word.

I have a problem in implementation of autocomplete function (like in Eclipse or IntelliJIdea)

I have:
1. Applet
2. JPanel
3. JEditorPane
4. JScrollPane for JEditorPane

Applet contains Jpanel, Jpanel contains JScrollPane.

I have a listener and I can to cath event of keyReleased(for ex. DOT) in JEditorPane.

How to realize the panel, which contains the set of words to complete the current one?




What should be after second comment?

Thanks!
 
Joan Horta Tosas
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you saying the list of words are in the panel or that the panel has to do something with the words that can be used?
If it's the first scenario, you can use, for example, an static field or method (depending in if these words can change if you pass some parameter or not) in the panel; that way it'll be visible from the JEditorPane with something like MyJPane.getWords(blablabla);
The second scenario I'm not really sure due to long time without making a visual app in Java.
By the way, I think a fast way to perform the search of these keywords will be using a binary tree, I think... Or at least that's what I recall...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!