Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 492
  • Last Modified:

How can I set icon on MenuItem?


I have created PopupMenu for SystemTray and added
MenuItem. Now I want to set Icon on MenuItem.
How can I resolve this?
0
mihir_amreli
Asked:
mihir_amreli
3 Solutions
 
ksivananthCommented:
menuItem = new JMenuItem("Both text and icon",
                         new ImageIcon("images/middle.gif"));
0
 
mihir_amreliAuthor Commented:

I know how to set icon on JMenuItem
but i need to set on MenuItem

bcoz,
if i use JMenuItem I cant add it into PopupMenu which only can be set on SystemTray!!!
0
 
littlegiraffeCommented:
I think you will have to create a JPopupmenu and populate it with JMenuitem(s).

I don't think menuItem supports Icons
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
GhythsCommented:
Hi Littlegirafee,


I think this is what you are looking for
http://java2s.com/Code/Java/Swing-JFC/Asimpleexampleofconstructingandusingmenus.htm

Regards
G
0
 
aciuicaCommented:
You can try JDIC library. They provide a similar interface wich support API with SystemTray and TryIcon wich allow JPopupMenu and you can use icons in JMenuItem. I checked in Windows Vista and is working. It seems to work on other platforms too. See: https://jdic.dev.java.net/
0
 
mrcoffee365Commented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now