aspose file tools*
The moose likes Java in General and the fly likes Refresh Windows Tray Icons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Refresh Windows Tray Icons" Watch "Refresh Windows Tray Icons" New topic
Author

Refresh Windows Tray Icons

Pronab Kahali
Greenhorn

Joined: Jun 17, 2008
Posts: 9
Hi All,
I created a java application which create a tray icon and do some operation. And I wrapped it in an exe by JSmooth.
But when I stopped the application from task manager the orphaned icon still there in system tray until I move the cursor over it.
Is there any way we can refresh the tray icons by java code ??
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

No. First - if you kill an app from TaskManager it ends abruptly, so it wouldn't go through normal shutdown procedures. Second, this same thing happens whenever you shutdown an app from the task manager. So it seems to be a Windows thing and not detecting that the process behind the icon is dead until it is moused over.


Steve
Pronab Kahali
Greenhorn

Joined: Jun 17, 2008
Posts: 9
Thanks, is there any way I can shutdown my exe normally means it should remove the icon from system tray?
The situation is - I bundled my java class in JSmooth exe wrapper and running it by command "Test start". it started properly.
To stop this exe I issue command "Test stop" which create another instance of Test.exe and shutdown the running process by command "TASKKILL /F Test.exe".
Is there any better way so I can shutdown the Test.exe gracefully ? I need it urgently..Please help...
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

You should add a menu to the tray icon with a command that signals the end of the application. How that signal should be implemented depends a lot on the application itself and what it does. How to make the tray icon menu depends on the library you are using for creating the tray icon (if you are using Java6's java.awt.TrayIcon then you would pass it a java.awt.PopupMenu menu items.)
Pronab Kahali
Greenhorn

Joined: Jun 17, 2008
Posts: 9
Hi, there is already a menu item called "Exit", when user clicks it, it works perfectly. But there is another way to start and stop the application with command "start" and "stop".
In that case "stop" creating the problem, it stops the process but icon remains in the system tray until touched by cursor.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

Then you haven't implemented the command correctly. Can you tell us what you did there?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Refresh Windows Tray Icons