6 Replies Latest reply: Aug 18, 2011 1:18 PM by Darryl Burke RSS

    Java System Tray Menu

    821444
      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
          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
            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
              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
                Darryl Burke
                Moderator action: Moved from Java Programming.

                db
                • 5. Re: Java System Tray Menu
                  880527
                  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
                    Darryl Burke
                    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