Skip to main content

autocomplete jlist

1 reply [Last post]
novelo
Offline
Joined: 2004-02-17

i have made a simple a thing like this
-->
DefaultListModel listModel = new DefaultListModel();
Vector al = af.getAnredenAsVector();
for(int i = 0; i

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bierhance
Offline
Joined: 2003-06-11

Hello Novelo!

We do not support this out of the box, because with a JList it's not possible to select an item that is not contained in the JList.

What you could do, is write an adapter that is somewhat a mixture of TextComponentAdaptor and ListAdaptor. This adaptor would have its own field to hold the selected value (as TextComponentAdaptor does) and therfore would be able to have an selected value that is not contained in the JList. I'd recommend that you start-off with the ListAdaptor and add the selection logic from the TextComponentAdaptor.

I hope this helps!

Best regards,
Thomas