This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Set a default value for spinner

 
Eder Suarez
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a guess after looking at the JavaDoc: setValue()?
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Eder Suarez
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot! This did it:






 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic