pup*_*eno 6 java notifications javafx
AWT的TrayIcon
类具有一种称为的方法displayMessage
,该方法显示Windows 10中的本机OS消息,如下所示:
作为一个弹出窗口,像这样:
在通知区域中。
JavaFX可以本地执行此操作吗?我知道JavaFX尚未实现托盘栏支持,并且必须使用AWT,但是这些通知是否与托盘栏相关?
显然,javaFx Still仍不提供显示托盘通知的方法,但是您可以使用3rd party库来实现您的目标。
String title = "Congratulations sir";
String message = "You've successfully created your first Tray Notification";
Notification notification = Notifications.SUCCESS;
TrayNotification tray = new TrayNotification(title, message, notification);
tray.showAndWait();
Run Code Online (Sandbox Code Playgroud)
* * * * * * * * *
Notifications.create()
.title("Title Text")
.text("Hello World 0!")
.showWarning();
Run Code Online (Sandbox Code Playgroud)