How can I create a JTextArea with Autocomplete?

131 views Asked by At

I want to make a program in which when I write in the JTextArea, but when I write a word, it gives me a suggestion on how to complete it. I tried Swingx's AutoCompleteDecorator, but when I finished a word it wouldn't let me type anymore when I had it set to true in strict mode, and if I had it set to "false" it wouldn't give me any more suggestions afterwards. I used the following function:

AutoCompleteDecorator.decorate(textArea, keys, false);

1

There are 1 answers

4
BigIO On

You can try the code as here.

Try this if you want dynamic fields using different key event listeners.