I need to check whether the value entered in JSpinner is valid or not on click of up/down arrow button. So I need to trap the up/down arrow button click events.
Steps to be followed 1. User entered value in the JSpinner manually without using the up/down arrow keys. 2. If the user presses up/down key then I need to validate whether the value entered in JSpinner is valid or not. If not then I need to display some default value.
set your own ui, extending BasicSpinnerUI override createNextButton() and createPreviousButton() add actionListeners to both buttons in actionPerformed, get the textfield and setValue(spinner.getValue())
if valid, no changes if invalid, previous valid value will be set
Of course, I found a very beautiful couch. Definitely. And this tiny ad: