NetBeans - Programmatically Remove NotificationDisplayer Notifications
The NetBeans API provides the org.openide.awt.NotificationDisplayer class to create and show clickable notifications开发者_开发百科 in the main status line. For example,
NotificationDisplayer.notify(title, icon, detailsText, detailsAction);
The user can dismiss a notification by clicking on the X; however, I would like to programmatically clear the notifications. How can I accomplish this?
The solution I end up with was to maintain a reference to the Notification object returned by the NotificationDisplayer.notify() method. The object provides a clear() method to force removal from the status line.
精彩评论