This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Hello, I am loading a JSpinner with a ascending sorted list of names; need to set the current row to show at startup the first, not the last row loaded. Have searched and do not see any method to do this in either the model or JSpinner.... thanks in advance!
If you want to force your JSpinner to select a specific value you can call yourSpinner.setValue().
If you're trying to muck with the order of your SpinnerListModel somehow (which, despite "top of list" in the subject line, seems odd if it is sorted) then please explain what you're trying to do in more detail.
OK - I have a list of names, say - Andy, Bill, Christina. These names are loaded into the array used to initialize JSpinner in this order -  Andy,  Bill, [3} Christina. When the JSpinner appears, "Christina" shows up, requiring the user to go up to find the rest of the names. Intuitively, one would expect the top name, Andy, to be shown and click on the down arrow of the spinner to get the rest of the names. I would have thought there was a "setCurrent" or some such method to point to the top of the list....thanks for any ideas...
Originally posted by Douglas Kent: I would have thought there was a "setCurrent" or some such method to point to the top of the list.
Well, again, I'm confused by "top of the list." I would say that Andy will always be the top of the list, even the current selected value of the spinner is Bill or Christina.
But that aside, let me say again that the setValue() method would seem to be the method you are looking for. Just call yourSpinner.setValue("Andy") or yourSpinner.setValue(yourValueArray). Simple, right? Or am I missing something? [ January 24, 2007: Message edited by: Brian Cole ]
Joined: Oct 06, 2000
Brian, All I want to do is set the default selected row to the "top" item (Andy in this example) instead of the last (Christina) as it happens when I create the spinner.