Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Refresh Windows Tray Icons

 
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 ??
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • 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: 4179
22
IntelliJ IDE Python Java
  • 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.
 
Sheriff
Posts: 21842
105
Eclipse IDE Spring VI Editor Chrome Java Ubuntu 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?
 
Oh, sure, you could do that. Or you could eat some pie. While reading this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!