0

My Java application gives user a textbox to input some String data.Domain size of input is around 500 words. I want to give suggestion when user starts typing a word. Something Like Google Automatic suggestion. Any idea how to do that?

mKorbel
  • 109,525
  • 20
  • 134
  • 319
cks
  • 83
  • 1
  • 2
  • 9

1 Answers1

1

Here is an example of how to do it:

http://www.java2s.com/Code/Java/Swing-JFC/AutocompleteTextField.htm

When you create an instance of this autocomplete textfield you have to pass your 500 words in there as a list.

Moh-Aw
  • 2,976
  • 2
  • 30
  • 44
  • i tried the above code but that just shows the first list value in textbox and user cannot type anything. – cks Apr 11 '14 at 13:10
  • unfortunately I can't check this until monday. – Moh-Aw Apr 11 '14 at 14:05
  • Worked fine. Here is a example that helped me.Thanks Moh-Aw!! http://stackoverflow.com/questions/7255636/is-it-possible-to-have-an-autocomplete-using-jtextfield-and-a-jlist/7255918#7255918 – cks Apr 12 '14 at 19:39