Java Swing - Problem in JSpinner
- by Yatendra Goel
I am developing a Java Desktop Application and designing the GUI with the help of Netbeans Swing GUI builder.
I want to use a JSpinner in my app. I have dragged and dropped it to a JPanel. Now, I want to set its two properties:
First, It should display numbers in the range of 1 to 50. Neither less than 1 nor greater than 50. How can I set that range?
Second, when I try to get the value of it by spinner.getValue() it returns an Object. As my spinner's data type is Integer, would it be better to downcast the Object into Integer or Is there any other way to get that numeric value?