Can JavaFX initially display OS notifications?

The AWT TrayIconclass has a method displayMessagein which it displays its own OS message, which in Windows 10 looks like this:

enter image description here

like a popup and like this:

enter image description here

in the notification area.

Can JavaFX do this natively? I know that JavaFX does not yet support tray support, and I need to use AWT, but do these alerts depend on notifications?

+4
source share
1 answer

Apparently, javaFx Still does not provide a way to display notifications on the tray, but you can use a third-party library to achieve your goal.

Traynotification

    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();

enter image description here

* * * * * * * *

ControlsFX

Notifications.create()
              .title("Title Text")
              .text("Hello World 0!")
              .showWarning();

enter image description here

+4
source

Source: https://habr.com/ru/post/1690591/


All Articles