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?