Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
// from 0 to 9, in 1.0 steps start value 5
SpinnerNumberModel model1 = new SpinnerNumberModel(5.0, 0.0, 9.0, 1.0);
JSpinner spin1 = new JSpinner(model1);
JFrame frame = new JFrame("Limiting value for a JSpinner");
SpinnerModel sm = new SpinnerNumberModel(0, 0, 9, 1); //default value,lower bound,upper bound,increment by
JSpinner spinner = new JSpinner(sm);
The valid range for this application is 0 to 9 but there seems to be
no NetBeans 7.0.1 JSpinner minimum or maximum value setting. Is there
another way to limit the range of this JSpinner to 0..9?
yes but without bothering insert code and/or with generated code from GUI Palette
add SpinnerListModel (easiest for this requirement and example in Oracle tutorial) or wrote own SpinnerNumberModel
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.