Solved

How to Color Elements in the JComboBox

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

757 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