I have a JComboBox and have 10 string items added in it.
I want to assign different colors to each item.
How i can achive this?
Please help.
I have a JComboBox and have 10 string items added in it. I want
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The example in Chandru’s answer looks like a lot of code so I can understand why you’re asking for an easier solution. However, if you subclass
DefaultListCellRenderera lot of the work is done for you, as this renderer is a subclass ofJLabel.