How to implement the 'auto complete' feature in a Jformattedtextfield?

Asked

Viewed 125 times

4

I need that when I type in JFormattedTextField pop up text suggestions. It would be possible to do this?

  • Yes!! Type the name nail. There it will appear: nail with head. Nail without head etc.

  • 1

    I found some links 10, I think it’s what you need! http://www.java2s.com/Code/Java/Swing-Components/AutoCompleteTextField.htm https://www.youtube.com/watch?v=zAWQ0p27fb0 https://www.youtube.com/watch?v=akuNoeQ9WGA

  • @Marianasempe thank you :)

1 answer

1

Hello, use Swingx this has a class called Autocompletedecorator

JComboBox comboBox = [...];
AutoCompleteDecorator.decorate(comboBox);
List items = [...];

JTextField textField = [...];
AutoCompleteDecorator.decorate(textField, items);

JList list = [...];
JTextField textField = [...];
AutoCompleteDecorator.decorate(list, textField);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.