File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Rendering JComboBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Rendering JComboBox" Watch "Rendering JComboBox" New topic
Author

Rendering JComboBox

Lisa Zapson
Ranch Hand

Joined: Nov 22, 2004
Posts: 50
I am trying to change the background color of the top area (the area where the arrow is) of the combobox.

Using a renderer I can change the background color of the selected item.
renderer.setBackground(isSelected ? Color.cyan : renderer.getBackground());

However if I use a condition for a specific value I can change the border of the top area with the arrow and the border of the selected item.
renderer.setBorder((value.equals("FNMA")) ? focusBorder : noFocusBorder);

The following does not work for the background color of the top area with the arrow.
renderer.setBackground((value.equals("FNMA"))? Color.cyan : renderer.getBackground());

Any ideas on how to change the background color of the combobox top area, the area with the arrow would be very much appreciated.

Is there a ComboBox Header?

Thanks Lisa
[ September 12, 2005: Message edited by: Lisa Zapson ]
Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
I'm not sure if this area counts as the editor or not. Try this:
Lisa Zapson
Ranch Hand

Joined: Nov 22, 2004
Posts: 50
That works if the combobox is editable. My combobox is not editable.

Thanks, Lisa
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Rendering JComboBox
 
Similar Threads
The color of arrow button in JCombobox is getting changed when chaging its background
programmatic change of text item color in JLIst
change properties of a comboobx
Non Editable JComboBox background color
JComboBox and Mac