Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何创建事件提醒。例如,用户创建了今天下午 5 点的事件并将其存储到数据库中。运行程序时,如果系统时间为下午 5 点,则会弹出提醒。有没有什么API可以做到这一点?从谷歌我得到的是那些免费软件。
假设您使用 Date 表示要触发警报的时间,请在 ScheduledExecutorService 中安排自定义 Callable 任务。
这段代码看起来像这样:
myScheculer.schedule(alertTime.getTime() - System.currentTimeMillis(), new AlertTask());
在 AlertTask 实现中,使用 JOptionPane.showMessage() 弹出通知。