spinner component

Jonathan Giles jonathan.giles at oracle.com
Sun Dec 18 15:53:29 PST 2011

>>   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?
> Jonathan's just done some similar stuff in his ComboBox, might be worth a
> look and see whether it could be adapted.
> Otherwise, possibly the getIndex(Value) could return null or throw an
> IndexOutOfBoundsException if it doesn't map back to an index - then the
> Spinner could decide to do what it likes with that (maybe just leave the
> 'text' as is, set the value and index to null and optionally add a psuedo
> style class of 'error').

 From my personal impression, the more common form of Spinner is the 
editable kind, so I would certainly consider this to be part of the spec 
for a JavaFX Spinner control, and one that would need to be supported in 
a first release.

I just reviewed the spinner UX specification to bring to light any other 
missing functionality that should be considered. I'll summarise some of 
the other details below. Note that, as with all UX specs, these entail 
the entire design of the control - normally we implement only portions 
of the spec in the first release, and iterate to include further 
features in future releases. The main thing is that, by knowing the 
entire design, we can be as sure as we can be that future features will 
be accommodated in the API we end up with. Here's the details, in 
summary form, without me trying to state how it should be done (although 
I have ranked them in order of importance for a first release, imho):

  * Ability to easily specify the 'step' - e.g. should the 
IntegerSpinner increment/decrement by 1, 10, 100 or 42?
  * Ability to easily specify the min/max values for a spinner.
  * Ability to configure where the spinner buttons appear (both on 
right, both on left, one on either side horizontally, one on either size 
  * Ability to easily specify a 'unit' - e.g. Showing "%" after a number 
that spins between 0 and 100 to represent percentages.
  * Ability to step portions of the value (e.g. the usual time / date 
spinner where the stepper increments/decrements the minutes value, 
because that is selected).

-- Jonathan

More information about the openjfx-dev mailing list