JDK-4908075 : Press shift and another key using robot does not trigger events properly - WinXP
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6,7u101,8u92
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000,windows_xp
  • CPU: x86
  • Submitted: 2003-08-18
  • Updated: 2016-08-11
  • Resolved: 2016-07-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b131Fixed
Related Reports
Duplicate :  
Relates :  
Description
When SHIFT key is pressed using Robot and some other key is pressed, both key-pressed and key-released is triggered for shift and the new key.

If SHIFT key is pressed, key pressed must be triggered.
When another key like (VK_RIGHT) is pressed and released, no key-pressed/key-released event must be triggered for SHIFT key. 
But in WinXP both key-pressed and key-released is triggered for SHIFT, every time some other key is pressed.

Compile and run RobotSelectTest
If key-pressed and key-released is triggered more than once, bug is reproduced.

In solaris, WinNT, Win2K, key-pressed and key-released is triggered only once (towards the beginning key-pressed is triggered for SHIFT and towards the end key-released is triggered)

Because of this problem, its not possible to select a text in TextField using Robot in WinXP. This feature is required for automating some of the test scenarios. There is no feasible work around, as we are trying to select some text in native components as well.

Comments
This is a long standing bug which was not fixed previously because of problems on Win98/WinXP. Nowadays, where we don't support these ancient Windows version any more, the fix is trivial.
14-07-2016

EVALUATION A small native application (generic.cpp, attached) shows the same behavior when we just post synthesized keyboard messages via keybd_event() call, if NumLock is ON. Currently in the new Microsoft OSes there is a superseding function SendInput() which perhaps behave better, however Windows 98 doesn't have it. Let's return to this bug in dolphin. If Windows 98 will be phased out, we'll avoid unnecessary branch in the Robot native code.
06-09-2005

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
17-09-2004

EVALUATION This bug is present in all JDKs back to at least 1.3.1. Ever since Robot was introduced, in other words. I've reproduced the problem on Win2K and WinXP. It is true of arrow-keys, but not of normal letter keys. The problem disappears if NumLock is off. ###@###.### 2003-08-18
18-08-2003

WORK AROUND Turn off NumLock ###@###.### 2003-08-18
18-08-2003