ADDITIONAL SYSTEM INFORMATION :
Windows 11
JDK 21.0.1
A DESCRIPTION OF THE PROBLEM :
Notifications vanishes from Windows 11 notification center after few seconds no matter what Windows settings is in use.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Notifications should stick into notification center if not cancelled, they vanishes after few seconds instead.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
public class Main {
public static void main(String[] args) throws Exception {
var frame = new Frame("Notification Example");
var button = new Button("Notify");
frame.add(button);
var image = new BufferedImage(32, 32, BufferedImage.TYPE_4BYTE_ABGR);
var trayIcon = new TrayIcon(image);
SystemTray.getSystemTray().add(trayIcon);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
e.getWindow().dispose();
System.exit(0);
}
});
button.addActionListener(e -> {
trayIcon.displayMessage("Hello World", "Lorem ipsum", TrayIcon.MessageType.INFO);
});
frame.pack();
frame.setVisible(true);
}
}
---------- END SOURCE ----------
FREQUENCY : always