JDK-8266423 : Triggering OS toast notifications without the use of SystemTray
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2021-05-01
  • Updated: 2024-08-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
A DESCRIPTION OF THE PROBLEM :
Currently, notifications in AWT can only be triggered by adding a TrayIcon to the SystemTray. This poses an issue: users likely do not want an icon to be in the menu bar (macOS) or application tray (Windows) without a specific use for it.

Separating the creation of notifications allows for the possibility to add new functionality. On Windows, you can include a few buttons with text, as well as a text area for input. OS Notifications also can also include images aside from the application icon from which it's been sent from. Notifications also can be persistent, in that they can be viewed again if not seen initially.

The API could be included in java.awt.Desktop, with a method named sendNotification(Notification). The Notification class having methods of setting the icon, image, header and body texts, and callback listeners. If some notification features are platform-exclusive, developers should check Notification.isSupported(Action), where Action is an enum with all notification features. If notifications are not present at all, this should be indicated through Notification.isNotificationSupported(). This would mirror other AWT desktop features (eg SystemTray, or Desktop).