I am trying to make a JSpinner (containing a minute/second timer) work for a bunch of set-in-their-ways folks who don't care beans about the mouse but want every keystroke to do exactly what they are used to. It works almost as I'd like it to but the last mile is the hardest.
What this means in practice is that the spinner should look and behave when one of its text fields gains focus exactly as it looks and behaves after the user has pressed an arrow key from one of those fields.
Spinner is created as follows:
this.countdown = new JSpinner(this.model);
this.editor = new JSpinner.DateEditor(countdown, "m:ss");
JFormattedTextField textField = editor.getTextField();
step 1. When my spinner comes up it looks like this: ('|' indicates the caret, bold indicates the selction)
|1:00
(Nothing is selected)
step 2. If Up Arrow is pressed from here It looks like this:
2|:00
(2 in minutes field is selected)
step 3. If Right Arrow is pressed from here we get:
2:|00
(Nothing is selected)
step 4. If Up Arrow is pressed from here we get
2:01|
(01 in seconds field is selected)
I'd like it to work in all these cases as it does in steps 2 and 4. When one of the subfields gains focus, it should be selected.
Is there any way to make this happen?