• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Autocomplete implementation problem

Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic