0

// TrayUtilitiesDemo is a call which is returning me tray icon create by current java process.

MyMenu.setLabel("MyMenu");
TrayUtilitiesDemo.addPopupMenu(MyMenu);
TrayIcon trayIcon = TrayUtilitiesDemo.getTrayIcon();
System.out.println("TrayIcons are: "+trayIcon);

when i am doing

trayIcon.getPopupMenu().countItems();

it is retrun only 1 menuitem. which is added by me that is MyMenu. there are other 4 menuitems are there added by some other class which is creating this tray icon.

and not able to get the ActionListener also. basically i want to right click on tray icon click and click on menuitem in PopupMenu added by other class(or by other process) for automation. using windows 7 machine.

please help.

Harpal
  • 135
  • 1
  • 7
  • can you share TrayUtilitiesDemo methods source – Shailesh Aswal Jun 17 '14 at 11:25
  • sorry i am from test department, i am not having access of that source code that name too i have changed. but some methods are there those i can use are like, addpopupmenu(),InitTraicon/showtrayicon/addlisteners. so was looking some direct way in java. – Harpal Jun 17 '14 at 13:31
  • seems TrayUtilitiesDemo maintains a singleton TrayIcon and provides utilities to work with it. Since the sequence of adding menuItems is not known, I can only assume that by the time you print count the other menuItems are not added in TrayIcon. – Shailesh Aswal Jun 17 '14 at 14:45

0 Answers0