简体   繁体   中英

Java Program and Windows Taskbar

I just wrote a desktop clock for me in java-swing and I wanted that clock to run everytime I log in.
For this I added the my jar file to start folder and I got the clock running.
But my problem is- the icon shown in the taskbar that allows me to close my application by clicking the cross mark shown at mouse over (Windows 7 style) or right click->close.
I want my application to run as the other windows processes (or desktop gadgets) and not to show the icon in the taskbar.

Thanks in advance !

Use a JDialog instead of JFrame. Dialogs do not show in the task bar.

I guess you might be interested in something like this
Put this code where you are creating the form

setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);

This disables any action on close.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM