Solved

How can I set icon on MenuItem?

Posted on 2010-09-01
7
440 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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 26

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
array220 challenge 8 48
countHi2 challenge 7 44
pairs challenge 5 45
maven project error 5 24
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now