Autocompletion - how to detect item NOT in list.

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Autocompletion - how to detect item NOT in list.

Postby bolsover » Wed Apr 01, 2015 2:34 am

I'm using AutoCompletionComboBox to allow user to select an item from an established list of String objects.

I can attach an ActionListener to the AutoCompletionComboBox which then notifies when an item is selected - good.

I also need to detect events when the String entered in the AutoCompletionComboBox is NOT in the established list of String objects. Is this possible? If so, how?

David
bolsover
 
Posts: 44
Joined: Thu Dec 05, 2013 5:23 am

Re: Autocompletion - how to detect item NOT in list.

Postby JIDE Support » Wed Apr 01, 2015 7:58 am

Not quite sure what you mean but AutoCompletionComboBox is pretty much self contained. You shouldn't need to do it anything. It will automatically filter the list based on what user typed.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36180
Joined: Sun Sep 14, 2003 10:49 am

Re: Autocompletion - how to detect item NOT in list.

Postby bolsover » Tue Apr 14, 2015 5:30 am

I'll try to explain a little better..

My AutoCompletionComboBox is initialized with a list of part numbers: "AAA", "AAB", "AAC".... "ZZZ".

The AutoCompletionComboBox is not Strict so the user is free to type a code not in the initial list: e.g.: "WXy123" In this case, I want to capture the text "WXy123" and preform some other action with this as a parameter.

How do I capture the text "WXy123"?

The normal call to AutoCompletionComboBox#getSelectedItem(); returns the closest match from the original initial list and NOT "WXy123".

Maybe the attached screenshot will help.

Regards, David
Attachments
PartCode.jpg
PartCode.jpg (79.27 KiB) Viewed 5479 times
bolsover
 
Posts: 44
Joined: Thu Dec 05, 2013 5:23 am

Re: Autocompletion - how to detect item NOT in list.

Postby JIDE Support » Tue Apr 14, 2015 9:32 am

If you want to detect what user typed in the text field, you will have to use textField.getDocument().addDocumentListener.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36180
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 3 guests

cron