Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-25-2008, 06:37 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,532
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Windows Linux conflict - TrayIcon image not display in Linux
Hi all,

I have create a TrayIcon and then add image and a pop-up menu into it as follows.

Code:
public void trayIconEventHandling() { TrayIcon trayIcon; if (SystemTray.isSupported()){ SystemTray tray = SystemTray.getSystemTray(); // I have to use this ActionEvent to exit the dialog as well // Exit from the complete application ActionListener exitListener = new ActionListener(){ public void actionPerformed(ActionEvent e){ System.out.println("Exiting..."); System.exit(0); } }; // Open the dialog in Actionevent ActionListener openDialogListner = new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Open another Dialog here."); new AboutWindow().setVisible(true); } }; // Tray icon menu implimenting goes here PopupMenu popup = new PopupMenu(); MenuItem defaultItem = new MenuItem("Exit"); MenuItem openDlgItem = new MenuItem("About"); MenuItem extartItem = new MenuItem("Others..."); openDlgItem.setEnabled(false); defaultItem.addActionListener(exitListener); openDlgItem.addActionListener(openDialogListner); popup.add(defaultItem); popup.add(openDlgItem); popup.addSeparator(); popup.add(extartItem); Image image = Toolkit.getDefaultToolkit().getImage("mytrayicon/RADAR.gif"); trayIcon = new TrayIcon(image, "Pop-up", popup); ActionListener actionListener = new ActionListener(){ public void actionPerformed(ActionEvent e){ System.out.println("Main Dialog!"); // Try to simply call the GUI here mainWnd.setVisible(true); } }; trayIcon.setImageAutoSize(true); trayIcon.addActionListener(actionListener); trayIcon.addMouseListener(mouseListener); try { tray.add(trayIcon); } catch (AWTException e) { System.err.println("TrayIcon could not be added."); } } else{ System.err.println("System tray is currently not supported."); } }
My code working well on Windows, loaded the image correctly. But in Linux it don't.

As far as I know about Java, I believe my code is correct. Then why this is happened on Linux. Somebody can give me a hint that where I'm going wrong.

Important thing here is, Linux does not give any exception also.

Eranga
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on July 27, 2008)

Last edited by Eranga : 03-25-2008 at 06:41 AM. Reason: adding more
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
open a pdf file in linux aparna Advanced Java 0 02-08-2008 03:24 PM
new member need help with linux praveena New To Java 0 01-22-2008 11:22 AM
problem with ServerSocket on Linux gabriel New To Java 1 08-07-2007 05:46 PM
eclipse in linux bbq Eclipse 1 07-04-2007 09:59 AM
Linux and java Alan Advanced Java 2 05-31-2007 03:30 PM


All times are GMT +3. The time now is 06:36 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org