JDK-5043230 : GTK L&F: Cannot set background color on JComboBox
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2004-05-06
  • Updated: 2004-05-10
  • Resolved: 2004-05-10
Related Reports
Duplicate :  
Description
Calling setBackground() on a JComboBox appears to have no effect whatsoever on GTK look and feel - no part of the combo box appears in the requested color; at the very least the cell renderer that paints the contents should honor the background color.  This causes problems when used as a table cell renderer.

See attached demo app (a NetBeans project - unzip and run "ant run" to build and run it) - it will show a frame, then on a timer, set the colors of all components in the frame, then do so again, also setting the selected state of all AbstractButtons in the frame.

(This issue originally intended to be part of bug 4997237 which has been closed)

Comments
WORK AROUND Write a custom cell renderer for the combo box which detects if it is running on GTK L&F and invokes its own painting logic in that case.
11-06-2004

EVALUATION Closing as a duplicate of 5043225. ###@###.### 2004-05-10
10-05-2004