JDK-5043225 : GTK L&F: Cannot set background color on JCheckBox
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: linux
  • CPU: x86
  • Submitted: 2004-05-06
  • Updated: 2004-06-10
  • Resolved: 2004-06-10
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Description
Calling setBackground() on a JCheckBox sets the background of the checkbox-box, but not the background of the component itself.  This causes problems when a JCheckbox is used as a table cell renderer - particularly, even overriding its painting logic to fill in the background color fails when it is selected.

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
EVALUATION Duplicates: 5043228 - JRadioButton 5043230 - JComboBox 5043232 - JSlider 5043235 - JTree ###@###.### 2004-05-10 Name: omR10226 Date: 05/21/2004 Default opacity of widgets under gtk is differ from other l&fs. The values of default opacity for widget you could see at GTKStyle.isOpaque. ComboBox, RadioButton and Slider is non-opaque widgets by default for gtk. So it doesn't fill background. JTree widget is coping native behavior and fill a space around of items by text background color. ====================================================================== You can have the radio button/slider/combo box fill their background if you set their opacity to true for GTK since GTK does not fill their background by default. Though you will notice the components may paint different color backgrounds than you specified when they are in different states, such as MOUSE_OVER, PRESSED and so forth. ###@###.### 2004-06-10
10-06-2004