• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

How to Add a Systemtray Icon on several machines ?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ,

i have created a small program to create a systemtray icon and i want this to be shown on multiple machines ,
how can i add trayicon on many machines running it from my machine ?

trayicon code:

if (SystemTray.isSupported()) {
final SystemTray tray = SystemTray.getSystemTray();
Image image =Toolkit.getDefaultToolkit().getImage("info.jpg");
PopupMenu popup = new PopupMenu();
final TrayIcon trayIcon = new TrayIcon(image, "Alert", popup);

// Info
MenuItem item = new MenuItem("Info");
item.addActionListener(new ShowMessageListener(trayIcon,
"Alert!", message, TrayIcon.MessageType.INFO));
popup.add(item);

// Close
item = new MenuItem("Close");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
tray.remove(trayIcon);
}
});
popup.add(item);

try {
trayIcon.setImageAutoSize(true);
tray.add(trayIcon);

/
Adding a Popup kind of Alert for Tray Icon
/
trayIcon.displayMessage("Alert!", message, MessageType.INFO);
} catch (AWTException e) {
System.err.println("Can't add to tray");
}
} else {
System.err.println("Tray unavailable");
}



BR,
chinnu
 
Sheriff
Posts: 22817
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please http://faq.javaranch.com/java/UseCodeTags

You can only add a system tray icon on the local machine with Java. To add the same tray icon on other machines as well, you will need to run a Java application on those machines that adds the tray icons.
 
chinnu choudary
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Prime wrote:Please http://faq.javaranch.com/java/UseCodeTags

You can only add a system tray icon on the local machine with Java. To add the same tray icon on other machines as well, you will need to run a Java application on those machines that adds the tray icons.



Thanks,
Rob

my actual idea is i have a UDPSender which is going to send a message to all machines in LAN or VLAN and i need to catch that message and show it as an alert in the tray on top of a trayicon as a popup message, now my UDPServer is OK and it is able to send messages to all te machines in my network ...but i am not able to figure out how to show that message as a alert in all those messages ?

any help is deeply appreciated!

BR,
Chinnu
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic