This discussion is archived
6 Replies Latest reply: Aug 18, 2011 11:18 AM by DarrylBurke RSS

Java System Tray Menu

821444 Newbie
Currently Being Moderated
Hi,

I am able to use a png icon in my system tray element. ( TrayIcon trayIcon =new TrayIcon(createImage("/images/e-vision3.png", "tray icon"));) . Now i need to add icons to some MenuItems. ie, Both menu name and an icon. I had tried a lot to make this working but failed. Please help me on this issue.

Thankyou.

Sreejith P.M.
  • 1. Re: Java System Tray Menu
    camickr Expert
    Currently Being Moderated
    Read the section from the Swing tutorial on [url http://download.oracle.com/javase/tutorial/uiswing/misc/systemtray.html]How to Use the System Tray. Swing components are not supported so you can't use images. There is a bug id in the tutorial with more information.
  • 2. Re: Java System Tray Menu
    821444 Newbie
    Currently Being Moderated
    Hi,

    Thank you for your answer,

    I am not using JMenuItem. in my application i had used awt MenuItem. (ie, used MenuItem aboutItem = new MenuItem("About"); not JMenuItem aboutItem = new JMenuItem("About"); ) We can add trat icon to system tray. when mouse right click the menu and menu items will show. I need to add some icons in the pop up menu items. Can i do this?

    Thankyou,

    Sreejith

    Edited by: user13423634 on Dec 29, 2010 10:34 PM
  • 3. Re: Java System Tray Menu
    camickr Expert
    Currently Being Moderated
    I am not using JMenuItem
    I know. My reply stated you can't use Swing components.
    I need to add some icons in the pop up menu items. Can i do this?
    Swing menu items support icons, but AWT menu items don't. Since you can't use Swing components then you can't use icons.
  • 4. Re: Java System Tray Menu
    DarrylBurke Guru Moderator
    Currently Being Moderated
    Moderator action: Moved from Java Programming.

    db
  • 5. Re: Java System Tray Menu
    880527 Newbie
    Currently Being Moderated
    camickr wrote:
    Swing components are not supported so you can't use images.
    I wonder why system tray context menu does not support Swing JMenuItem? A menu with icons would be really nice for users. Is there any trick around to get rid of this limitation?
  • 6. Re: Java System Tray Menu
    DarrylBurke Guru Moderator
    Currently Being Moderated
    Moderator advice: Please don't post to old long dead threads and don't hijack another poster's thread. When you have a question, start your own thread.

    Moderator action: Locking this thread.

    db

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points