File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Spring in Action this week in the Spring 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: 19718
    
  20

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:






 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Set a default value for spinner