Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

best way to program expiry date

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am doing a program using Java 6 update 11 on Vista with 3 gigabytes of RAM. I am pleased with everything
so far, especially the speed at which my program's GUI executes when it comes to using transparency on a JWindow.

My program allows the user to create a post-it note which consists of 3 JPanels placed in the NORTH, CENTER and SOUTH
regions of the JWindow. The middle panel is devoted to the text note which is painted. So far so good.
I would like the user to be able to set an expiry date and time when the note will disappear.
I can store the date and time in a JavaBean. But I want to know what is the best way to monitor
the date and time while the program is running via the tray class I have created.
The tray class runs if the user creates any number of notes.

I am not asking how to program it, just what approach should be used.

I am assuming some kind of thread that runs in the background if any given note has an expiry date attached to it.
But how to use the computer's date and time checked against that of the DateBean in realtime.

Thanks and happy new year.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create a ScheduleExecutorService with the Executors utility class and then you can add to it scheduled tasks for each expiry date/time.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, I will try it.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic