aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes best way to program expiry date 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 » Swing / AWT / SWT
Bookmark "best way to program expiry date" Watch "best way to program expiry date" New topic
Author

best way to program expiry date

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Nov 22, 2008
Posts: 18944
thanks, I will try it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: best way to program expiry date