How to create a event reminder. Example, an user created an event which is today 5.00pm and stored it into database. When ruun the program the reminder will pop up if the system time is 5.00pm. Is there any API can do that? From google what I got was those freeware.
Asked
Active
Viewed 3,050 times
1 Answers
0
Assuming you use Date to represent the time you want to fire the alert, schedule a custom Callable task in a ScheduledExecutorService.
Ths code would look like this:
myScheculer.schedule(alertTime.getTime() - System.currentTimeMillis(), new AlertTask());
In the AlertTask implementation, use JOptionPane.showMessage() to pop the notification.

ddimitrov
- 3,293
- 3
- 31
- 46
-
Hi can use TimerTask to do so? – user236501 Jun 09 '10 at 11:33
-
Yes you can if you prefer. No big difference. See also http://stackoverflow.com/questions/409932 and http://stackoverflow.com/questions/637110 – ddimitrov Jun 09 '10 at 12:43