0

如何创建事件提醒。例如,用户创建了今天下午 5 点的事件并将其存储到数据库中。运行程序时,如果系统时间为下午 5 点,则会弹出提醒。有没有什么API可以做到这一点?从谷歌我得到的是那些免费软件。

4

1 回答 1

0

假设您使用 Date 表示要触发警报的时间,请在 ScheduledExecutorService 中安排自定义 Callable 任务。

这段代码看起来像这样:

myScheculer.schedule(alertTime.getTime() - System.currentTimeMillis(), new AlertTask());

在 AlertTask 实现中,使用 JOptionPane.showMessage() 弹出通知。

于 2010-06-09T10:31:47.790 回答