How to limit JSpinner
In my Netbeans 7.3 i followed theese steps: Step 1: Step 2: Step 3: And final step 4: That works for me.
In my Netbeans 7.3 i followed theese steps: Step 1: Step 2: Step 3: And final step 4: That works for me.
The answer is to configure the formatter used in the JFormattedTextField which is a child of the spinner’s editor: formatter.setCommitsOnValidEdit(true); Unfortunately, getting one’s hand on it is as long and dirty as the introductory sentence: final JSpinner spinner = new JSpinner(); JComponent comp = spinner.getEditor(); JFormattedTextField field = (JFormattedTextField) comp.getComponent(0); DefaultFormatter formatter = (DefaultFormatter) field.getFormatter(); … Read more