• Post Reply Bookmark Topic Watch Topic
  • New Topic

changing format for timer.  RSS feed

 
Jean Stu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im making a javabean for stopwatch which works perfectly, but i want in the property descriptor format, so the user can change its format.

currently i have;


currently the timer works its format is in 00:00 minutes:seconds, but i want it to start as MMMM d, yyyy h:mm:ss, for example March 17 2014 00:00:01, so only one second has passed here. i believe the set and get format method is fine but the timerhaschanged needs to change as this is where the format takes place.
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your timerHasChangedmethod will need to use the SimpleDateFormatter you have created in setDisplayFormat rather than creating it's own Formatter object. The code will also have to either set 'formatter' to a default value or handle it being null in the event that setDisplayFormat is not called.
 
Jean Stu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony Docherty wrote:Your timerHasChangedmethod will need to use the SimpleDateFormatter you have created in setDisplayFormat rather than creating it's own Formatter object. The code will also have to either set 'formatter' to a default value or handle it being null in the event that setDisplayFormat is not called.


i dont understand :-(, could you explain in details
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!