I have a Java application that resets to the system tray when I click the red cross.
Whenever this happens, I display a message informing the user that the application is still running in the system tray.
Here is the code for this:
...
@Override
public void windowClosing(WindowEvent e) {
try {
tray.add(trayIcon);
trayIcon.displayMessage("", "The application has been reduced
in the system tray, to stop it, press the \"Quit\" button",
TrayIcon.MessageType.WARNING);
setVisible(false);
} catch (AWTException ex) {
System.out.println("unable to add to tray");
}
}
...
At the moment, the message disappears if the user clicks on it.
I would like to set the counter so that the message disappears after a couple of seconds, even if nothing has been done.
Does anyone know a good way to do this because I cannot find any existing method for this.
EDIT
, , , , , 7-8 , . , , ( ).
, : , Java Windows?