private void tryCommit ( ) { try { JComponent editor = spinner . getEditor ( ) ; if ( editor instanceof JSpinner . DefaultEditor ) { JSpinner . DefaultEditor defaultEditor = ( JSpinner . DefaultEditor ) editor ; defaultEditor . commitEdit ( ) ; } } catch ( ParseException e1 ) { // Ignored } }
Try to commit the current value to the spinner editor . This is necessary in order to validate the number in the model against the displayed value .