*
The moose likes Beginning Java and the fly likes Set a default value for spinner Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Set a default value for spinner" Watch "Set a default value for spinner" New topic
Author

Set a default value for spinner

Eder Suarez
Greenhorn

Joined: Jun 15, 2011
Posts: 13
Hey there, I have more than one hour-choose spinner. The thing is, when i run my program, the default value is the actual time. Is there a way of setting the default value to "00:00"?

Thanks in advance.


Here's the code:

Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Just a guess after looking at the JavaDoc: setValue()?


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Create a Date object with a time of 00:00, and set that for the spinner. You can use java.util.Calendar to get such a Date object. Another option is to use new Date(0), but I'm not sure how that will work out.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Eder Suarez
Greenhorn

Joined: Jun 15, 2011
Posts: 13
Thanks a lot! This did it:






 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Set a default value for spinner
 
Similar Threads
Issues with fetching Year and Month from the Calender
Which Swing component to use ?
2 JSpinners has my head spinning!
unable to retrieve timestamp in my servlet
Jspinner Date increment