Skip to main content

Auto-Completion for Spinners?

2 replies [Last post]
krheinwald
Offline
Joined: 2004-06-25
Points: 0

I was wondering whether anyone already considered to enhance the autocomplete functionality to work with JSpinner.ListEditor?

Just so I don't duplicate efforts...

Klaus

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
Points: 0

Hallo Klaus,

> I was wondering whether anyone already considered to
> enhance the autocomplete functionality to work with
> JSpinner.ListEditor?

I don't know of anybody who implemented this already. If you decide to implement this functionality and have any doubts while coding, don't hesitate to contact the mailing
list.

Of course, contributions are welcome...

Warm regards,
Thomas

krheinwald
Offline
Joined: 2004-06-25
Points: 0

Sometimes things are easier as you think they are ;-)

import javax.swing.JSpinner;
import javax.swing.SpinnerListModel;

...

public static void decorate(JSpinner spinner) {
decorate(
((JSpinner.DefaultEditor) spinner.getEditor()).getTextField(),
((SpinnerListModel) ((JSpinner.ListEditor) spinner.getEditor()).getModel()).getList(),
true, ObjectToStringConverter.DEFAULT_IMPLEMENTATION);
}

Edit: It seems strictMatching is not handled properly, i.e. characters typed are case sensitive and are appear as new text in the spinner. Any hints on where to start looking?

Klaus

Message was edited by: krheinwald