Hiding my program in the System Tray in Windows

Adam Smith picture Adam Smith · Jul 3, 2011 · Viewed 7.1k times · Source

I'd like my program to display an icon in the TaskBar Status Area near the clock in Windows and found a way to do so.

The thing is, I'd like my program to stay open in the Status Area if the "X" is pressed on the window, but not in the System Tray, but I have no idea how to do so and searching on Google didn't help (I'm probably not searching the right terms).

Edit: I think I used the wrong terms. I know how to have my program's icon in the notification area, what I'd like is to hide it in the area where it is normally displayed when you minimize a window.

Answer

camickr picture camickr · Jul 3, 2011

I know how to have my program's icon in the notification area, what I'd like is to hide it in the area where it is normally displayed when you minimize a window.

Then don't use the system tray.

The thing is, I'd like my program to stay open in the Status Area if the "X" is pressed on the window,

frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);