Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

best way to program expiry date

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks, I will try it.
 
Not so fast naughty spawn! I want you to know about
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic