• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Refresh Windows Tray Icons

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ??
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22716
129
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then you haven't implemented the command correctly. Can you tell us what you did there?
reply
    Bookmark Topic Watch Topic
  • New Topic