Hi,
I'm using AutoCompleteTextField to suggest contacts from user's phone. User may add several ones, so I'm adding the names to other list when action is performed. It appears that getText() only returns the typed text at this point, not the one that is just selected from the the list. For example if I write "Bart" and select "Bart Simpson", getText() returns "Bart". Is there a way to get the actual selected value with this listener at this point? I know that it is doable if use for example data changed listener but then I'd have to validate the getText() from the contacts every time data is changed. Is there a better way to do this?
participant.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (ObjectUtils.isNotNullOrEmpty(participant.getText())) {
participantList.addItem(participant.getText());
}
}
});