简体   繁体   English

Javafx在特定时间弹出提醒作为通知

[英]Javafx pop up reminder as notification at certain time

I'm currently designing a simple task managing program. 我目前正在设计一个简单的任务管理程序。 I want to implement a pop up reminder function for my program. 我想为我的程序实现一个弹出提醒功能。 ie: users can enter some tasks to done by some date. 即:用户可以输入一些要在某个日期之前完成的任务。 eg: finish report by 2pm 12/10/2014. 例如:在2014年12月10日下午2点之前完成报告。

I would like to use java or javafx to implement popup reminder where the software will pop a window like 1 hour before the event time. 我想使用java或javafx实施弹出提醒,该软件将在事件发生前1小时弹出一个窗口。

I have searched on google but the results are mostly related to android programming. 我在Google上进行了搜索,但结果大多与android编程有关。 So could someone please share with me on what API i should use? 所以有人可以和我分享我应该使用什么API吗? or provide me with a hint as to how to implement this. 或为我提供有关如何实施此方法的提示。

Thanks in advance! 提前致谢!

I managed to solve the problem with ControlsFX notification for the notification window. 我设法通过通知窗口的ControlsFX通知解决了该问题。

code sample: Notifications.create() .title("Task Reminder") .text(eventDescription) .showWarning(); 代码示例:Notifications.create().title(“任务提醒”).text(eventDescription).showWarning();

I'm able to create a small pop up window at the bottom right of the screen. 我可以在屏幕的右下方创建一个小的弹出窗口。 However, to use the code, you need to add ControlFx to the project library. 但是,要使用代码,您需要将ControlFx添加到项目库。 And make sure to put the code at where the UI Application is because Javafx only works in the UI tread. 并确保将代码放在UI应用程序所在的位置,因为Javafx仅在UI界面中起作用。

As for the date comparison, just use java Calendar.It has useful APIs in it. 至于日期比较,只需使用Java日历即可,它具有有用的API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM