• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Refresh Windows Tray Icons

 
Pronab Kahali
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4181
21
IntelliJ IDE Java Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pronab Kahali
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then you haven't implemented the command correctly. Can you tell us what you did there?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic