This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Hi, I need to have a JComboBox which contains a list of names.. say "Joe", "saj", "sanjay", "ajai".... so on. Now depending on some condition i need these names to appear either in Red or in Blue. I know that i can have my own class MyCellRenderer which extends JLabel implements ListCellRenderer and i can set this as the renderer for my JComboBox. But my requirement doesnt end with this. When i made my own rendered i noticed that though the names in the dropdown list appeared in the color i wanted, yet the name that appears next to the "arrow" button is in Black. Also when i didnt have a renderer, the drop down list would automatically listen to the keys. For example if i type 's', the focus would automatically go to the first item that starts with 's'. However when i use my renderer, this doesnt happen. Help me solve these 2 problems . Kindest regards Saj