Solved

How to Color Elements in the JComboBox

Posted on 2001-07-05
4
357 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
  • 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Weekend adv creator 3 38
Java Timer (static) 9 44
eclipse buid path vs tomcat lib path 10 23
What's wrong with this code? 4 23
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
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 …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

810 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