spinner component
Tom Eugelink
tbee at tbee.org
Sun Dec 18 11:57:23 PST 2011
>
> Id vote for non-abbreviated method names though (even for well known abbreviations like this) ie 'getIndex'
No problem, I was thinking about that as well. The "increment" and "decrement" on the spinner should become "next" and "previous" as well, to further hide the index from the spinner's API (this was evolutionary coding).
> Would there ever be a need to select by index though (I'm hoping not)? I can see a possible need for selectFirst (ie reset) but this is probably achieved by knowing what the first 'value' should be and calling set with that (eg setValue(new Date())).
You can always do index things through the data provider, like :
I firstIndex = spinner.getDataProvider().getPreviousIndex(null); // getting the previous of null returns the first index (this is also used when cycling).
T firstValue = spinner.getDataProvider().getValueForIndex( firstIndex );
spinner.setValue(firstValue);
It could be convenient to have some convenience methods (he he) like first, last.
> Last minute thought. I haven't checked (typing on my phone) but is your Spinner editable in the sense that you could free type in it (like the ComboBox)? That might be nice - it should probably use the same StringConverter design as ComboBox if it is to support this.
I have not thought about it. Editable spinner. Hm. How would that work? What happens if I type a value that is not part of the data provider?
Tom
More information about the openjfx-dev
mailing list