My java application currently has an icon in the system tray. When the system tray crashes, however (you can simulate this by killing explorer.exe in the taskbar), the icon disappears after the system tray returns.
When I check SystemTray.getSystemTray().getTrayIcons() for the icons in the system tray, it always shows that my TrayIcon is still in the system tray, even though after it crashes and reloads and my tray icon is longer there.
At the moment I'm removing and adding my icon once every 15 seconds or so, but is there any other way of implementing this so that it won't keep disappearing and appearing and annoying the user?
Just in case anyone else stumbles across this and wonders what happened, in the end I had to stick with removing and adding the icon after a few seconds, because Windows does not update the JVM on the status of the tray icons... It was naturally not the best way to fix it, but there didn't seem to be a better way.