I’m looking for a JSpinner-like component that would provide built-in buttons that would immediately set the spinner value to the minimum or the maximum of the jspinner model. Before implementing this myself, I thought that somebody might have done it before, though my google searches on the topic were not successful.
Is there such a component out there, or should I code it myself ? Thanks for your help.
I can’t think of any component that would do it out of the box. But basically, a simple flow layout with a minus button, a spinner and a max button would do. Both buttons would have
actionListenersthat will ask the spinner for min and max values and set its value.Use a changeListener on the spinner to be notified of value changes both programatically (using your buttons) and through user interaction.
Also, you could consider using a JCombobox if your values are discrete or a JSlider if they are not, as both components present upper and lower bounds more clearly to users.
Regards,
Stéphane