I am showing a frame with a button. I have implemented a KeyEventDispatcher which would consume all the key events triggered by the button and it's dispatchKeyEvent() method returns true to prevent further processing of those events by the KeyboardFocusManager. But when I press space bar, the button responds by triggering an action event on Win32. But the button is not getting visually pressed.
This is reproducible on WinXP since JDK1.4+. This is not reproducible on Solaris / Linux where the button does not trigger any action event when the space bar is pressed. I tried the same with JButton on WinXP and this issue does not occur with Swing button.
The button should not trigger action event when space bar is pressed. But if that is a native behavior, at least it should respond visually to show the user that it is pressed.
I have attached a sample test. Execute the sample test. You would see a frame with a JButton and a Button. Make sure the focus is in AWT button. Press the space bar. If the console shows 'Button Clicked' message, the bug is reproduced.