开发者

Java Swing how to create a task reminder [closed]

开发者 https://www.devze.com 2023-01-02 16:08 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

开发者_如何学运维

Closed 4 years ago.

Improve this question

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消