Solved

How can I set icon on MenuItem?

Posted on 2010-09-01
7
447 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
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 168 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
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.

 

Assisted Solution

by:Ghyths
Ghyths earned 166 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 166 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: 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.

Question has a verified solution.

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

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

829 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