As shown above, I get a GUI with a left-right spinner that works perfectly until I try to change the model,
If I comment out " spinner.setUI( new LeftRightSpinnerUI() );" I lose my left-right spinner, but can change the range and increment without problems.
I've been trying to sort out what I need to get both actions working, but I am somewhat confused about the relationship between the editor, UI and model. I see I can setEditor in JSpinner, but it is being created in LeftRightSpinnerUI and I'm not quite sure why it is recreated if I change the model. Could someone help me understand this better?
As said in the earlier thread, the suggested solution required (much) more testing. But it's easy to see where the error comes from; the layout manager used by BasicSpinnerUI (in private static class Handler) expects a constraint of "Editor" while the BorderLayout I substituted doesn't recognize "Editor" as a valid constraint. A quick an easy fix is to use an extended BorderLayout that translates "Editor" to CENTER. To do that, change the setLayout(...) call in installUI(...) toPlease tell us whether that solves your problem.
There are no new questions, but there may be new answers.
Joined: Oct 10, 2011
Thank you very much (times 2, since the original post was also really helpful).
I made the change and my example works. I have a left-right spinner and can change the range and increment.