Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How can I set icon on MenuItem?

Posted on 2010-09-01
7
Medium Priority
?
469 Views
Last Modified: 2013-12-29

I have created PopupMenu for SystemTray and added
MenuItem. Now I want to set Icon on MenuItem.
How can I resolve this?
0
Comment
Question by:mihir_amreli
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 26

Expert Comment

by:ksivananth
ID: 33584225
menuItem = new JMenuItem("Both text and icon",
                         new ImageIcon("images/middle.gif"));
0
 

Author Comment

by:mihir_amreli
ID: 33584422

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
 

Accepted Solution

by:
littlegiraffe earned 672 total points
ID: 34097707
I think you will have to create a JPopupmenu and populate it with JMenuitem(s).

I don't think menuItem supports Icons
0
The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 

Assisted Solution

by:Ghyths
Ghyths earned 664 total points
ID: 34342028
Hi Littlegirafee,


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

Regards
G
0
 
LVL 5

Assisted Solution

by:aciuica
aciuica earned 664 total points
ID: 34738345
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
 
LVL 27

Expert Comment

by:mrcoffee365
ID: 37126827
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question