Solved

How to Color Elements in the JComboBox

Posted on 2001-07-05
4
376 Views
Last Modified: 2008-02-01
Dear Friends


How do i color different elements in the JComboBox.
I want that when i select an element in the JComboBox it is highlighted with different color but not with the deafult color. i want different colors for different elemts in the combobox.



Thanxs in advance

Bye
prasad
0
Comment
Question by:sdinfosys
[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
  • 2
4 Comments
 
LVL 92

Accepted Solution

by:
objects earned 30 total points
ID: 6258332
prasad,

You need to define your own ListCellRender using the setRenderer method.
Your renderer probably just needs to extend DefaultListCellRenderer adding the enhancements you require.
0
 

Author Comment

by:sdinfosys
ID: 6258396
Objects

Thanxs Objects for your instant reply.
i will try that and get u know.

bye objects
Prasad
0
 
LVL 92

Expert Comment

by:objects
ID: 6258399
No worries, let me know if you have any problems :)
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 8975012


No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:


-- points to objects


Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
sudhakar_koundinya
EE Cleanup Volunteer
---------------------
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post your concern in THIS thread.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

691 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