posted 14 years ago
Minimizing to the system tray is done by adding an icon to the system tray, then calling setVisible(false) on your frame to hide it from the task bar. You may want to keep normal minimizing in there for the effect. The procedure is then like this (using a WindowListener):
To show it again, turn off the minimized (iconified) state and show it again:
To minimize in the closing event (which is called when you press the X) as well use the reverse for minimizing:
Keep in mind that this will cause another windowIconified event, so if you minimize in the closing event remove the hiding and the tray icon code from that event. The other event will handle that.
Moving to our Swing forum.