Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Rendering JComboBox  RSS feed

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure if this area counts as the editor or not. Try this:
 
Lisa Zapson
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That works if the combobox is editable. My combobox is not editable.

Thanks, Lisa
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!