I have successfully created a custom renderer for a JComboBox (to change the background color of the pull-down menu, so this color agrees with the background color of the JPanel that is holding the JComboBox, which has been changed to light blue).
But I still have two problems:
First, the combobox lost the mouseover effect - the default renderer works like if you bring up the pulldown menu, and mouseover any item, that item will be highlighted. With my custom renderer, this effect is gone...
Second, is it possible to create a gradient effect on the JComboBox? Like the up-to-down or left-to-right gradient. I wonder whether I need a different look and feel scheme to achieve this...
here's a gradient button (not sure where this came from)
Joined: Jun 28, 2006
Thank you, Michael!
Now I can use the recursive algorithm you showed me yesterday to traverse through all the comboboxes and give them different background colors.
And the GradientPaint example is just easy to follow - basically we can use the GradientPaint(x1,y1,Color.blue,x2,y2,Color.white,true) to generate color patterns. It all depends the setting of the coordinates how the color pattern is going to "gradiate".