JDK-6492990 : Checkbox on a non-focusable frame changes the color when selected/de-selected, win32
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-11-13
  • Updated: 2011-04-29
Related Reports
Relates :  
Description
I have few checkboxes and radio buttons on a non-focusable frame. When the frame is shown initially, the background of the square portion of the checkbox appears in white color. But when I select or de-select it, the background turns gray and it stays gray in color after that. This appears as if the checkbox is disabled. 

This is reproducible on Win32 ever since 1.4.2 but not on 1.4. This is not reproducible on XToolkit. 

I have attached a sample test. Execute the sample test. Check the colors of the radio button/checkboxes. Select any of the checkboxes/radio buttons and you will see that the background (square/round portion) changes to GRAY.

Comments
EVALUATION The gray background is painted in the AwtCheckbox::OwnerDrawItem() method with the call to ::DrawFrameControl(). The latter GDI routine accepts the last parameter as a state of the button: checked/unchecked, radiobutton/checkbox, etc. One of the flags that can be set in the state parameter is DFCS_PUSHED, we set it when drawInfo contains ODS_SELECTED bit. In the normal (focusable) windows ODS_SELECTED bit is set only when the checkbox is redrawed because it is pushed, i. e. when user presses the mouse button on the checkbox, while in the unfocusable windows this bit is always set, i. e. when user presses OR releases the mouse button.
15-11-2006