2

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 !

iAmLearning
  • 1,153
  • 3
  • 15
  • 28

3 Answers3

4

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

Durandal
  • 19,919
  • 4
  • 36
  • 70
2

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.

lazyprogrammer
  • 633
  • 9
  • 26
  • Thanks Anirudhvarma ! Actually I wanted no icons to be displayed in taskbar which I got by Durandal's answer however your answer was also very helpful. – iAmLearning Feb 16 '13 at 15:49
1

Do the decoration of the window yourself.

http://docs.oracle.com/javase/7/docs/api/java/awt/Frame.html#setUndecorated(boolean)

See also : How do I put a Java app in the system tray?

Community
  • 1
  • 1
Aubin
  • 14,617
  • 9
  • 61
  • 84
  • Hi Aubin ! I am talking about the icon in the windows taskbar and not the title bar of my application(I already have setUndecorated as true). And also I don't want any icon to be placed in taskbar tray as well(your second link). – iAmLearning Feb 16 '13 at 15:35
  • anirudhvarma gives the answer you expect, I think. – Aubin Feb 16 '13 at 15:39