preventing JSpinners from taking non-positive integers
I want to program a JSpinner such that the user cannot enter anything other than positive integers. As it stands now, a JSpinner is like a glorified JTextField in that the user can enter whatever characters (s)he wants. I'm using it to enter a person's age, so I want to prevent users from entering values like "abc". I'd much rather do this than implement sophisticated error checking once the user hits submit. Is there any example code online that shows how to do this? Can anybody tell me straight out how to do this?
set the spinner model to be a SpinnerNumberModel bouded from 0 to MAX_INTEGER, starting at.. er.. 1?
and try JSpinner.setModel(...)
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center