Import Java. AWT. awtexception; import Java. AWT. image; import Java. AWT. systemtray; import Java. AWT. toolkit; import Java. AWT. trayicon; import Java. AWT. event. actionevent; import Java. AWT. event. actionlistener; public class traytest {static image = toolkit. getdefatooltoolkit (). getimage ("E: \ Java \ test \ icon \ 44.png"); static trayicon = new trayicon (image," test tray icon "); public static void main (string [] RGS) {If (systemtray. issupported () {systemtray tray = systemtray. getsystemtray (); trayicon. setimageautosize (true); // you can specify the attributes for automatic resizing. Trayicon. addactionlistener (New actionlistener () {public void actionreceivmed (actionevent e) {system. Out. println ("Where is it? "); // Displaymessage: a message is displayed near the tray icon. // Trayicon. messagetype java. AWT determines which icon will be displayed in the message title, and the possible system sound generated by the message based on the display. Trayicon. displaymessage ("tester", "What do you see? ", Trayicon. messagetype. info) ;}}); try {tray. Add (trayicon) ;}catch (awtexception e) {e. printstacktrace ();}}}}