File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes jspinner question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "jspinner question" Watch "jspinner question" New topic

jspinner question

john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
how would I go about setting the initial value i.e. lets say I have a spinner with a list of values and I want the initial value to be the 7th or nth value of the list how do I go about doing this?

Thank you all
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
spinner.setValue(Object value);
If you need to inspect the values contained in the model you can move through them with the 'getPreviousValue' and 'getNextValue' methods (which are contained in both the JSpinner and its model classes).
[ May 27, 2005: Message edited by: Craig Wood ]
Pat Hays
Ranch Hand

Joined: Aug 20, 2004
Posts: 138
spinner.setValue(new Integer(7));

The initial value will be 7

Download Java GUI Builder, <a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: jspinner question
jQuery in Action, 3rd edition