When the application is shut down, again, the standard approach: trayIcon.removeActionListener(listenerDefinedEarlier) The above code is meant to show that the technique for showing the application icon is only the standard approach.
SystemTray.getSystemTray().add(trayIcon) TrayIcon.addActionListener(listenerDefinedEarlier) TrayIcon trayIcon = new TrayIcon(imageFromIcon, 'My Proggy\nrunning', popupDefinedEarlier) Image imageFromIcon = ((ImageIcon)imageIcon).getImage() ImageIcon imageIcon = new ImageIcon(iconUrl) This can be made to work using code similar to as follows: URL iconUrl = ().getResource('logo.gif')
Using standard, a desktop Java application is able to create an icon when the program starts and remove the icon when the program ends.