JDK-4708221 : REGRESSION: Extra KEY_TYPED keyevent generated with missing modifiers
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2002-06-26
  • Updated: 2002-10-09
  • Resolved: 2002-10-09
Related Reports
Duplicate :  
Relates :  
Relates :  
Description

Name: rmT116609			Date: 06/26/2002


FULL PRODUCT VERSION :
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)


FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195], SP2

EXTRA RELEVANT SYSTEM CONFIGURATION :
Czech locale

A DESCRIPTION OF THE PROBLEM :

There are extra KEY_TYPED keyevent generated after both
KEY_RELEASED events in case Alt+Left is pressed (and many
others). This extra KEY_TYPED is not generated on 1.3.1.
Although I have nothing against generation of the KEY_TYPED
event it must have the Alt modifier filled in properly
otherwise the filtering in defaultKeyTypedAction in the
editor kit will not filter out that KEY_TYPED event and the
text will get inserted into the document. This makes the
Alt+Left shortcut and many others unusable on 1.4. I think
this already happen in past on 1.2 or 1.1 so I've marked
this bug as regression.



REGRESSION.  Last worked in version 1.3.1

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run attached app with JEditorPane on W2k
2. Press Alt then Cursor-left and then release both keys
3. Comma will appear in the JEditorPane's document which is wrong IMHO.


EXPECTED VERSUS ACTUAL BEHAVIOR :
Console Output on 1.4:
KEY_PRESSED,keyCode=18,keyChar='?',modifiers=Alt,extModifiers=Alt,keyLocation=KEY_LOCATION_LEFT
---------------------------------
KEY_PRESSED,keyCode=37,Left,modifiers=Alt,extModifiers=Alt,keyLocation=KEY_LOCATION_STANDARD
---------------------------------
KEY_RELEASED,keyCode=37,Left,modifiers=Alt,extModifiers=Alt,keyLocation=KEY_LOCATION_STANDARD
---------------------------------
KEY_RELEASED,keyCode=18,keyChar='?',keyLocation=KEY_LOCATION_LEFT
---------------------------------
KEY_TYPED,keyCode=0,keyChar=',',keyLocation=KEY_LOCATION_UNKNOWN
---------------------------------

Console output on 1.3.1:
KEY_PRESSED,keyCode=18,keyChar='?',modifiers=Alt
---------------------------------
KEY_PRESSED,keyCode=37,Left,modifiers=Alt
---------------------------------
KEY_RELEASED,keyCode=37,Left,modifiers=Alt
---------------------------------
KEY_RELEASED,keyCode=18,keyChar='?'
---------------------------------

REPRODUCIBILITY :
This bug can be reproduced always.

The problem is also reproducible on Windows 2000 using 1.4.1-beta.

---------- BEGIN SOURCE ----------

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

class KeyEventTest {
    
    public static void main(String args[]) {
        JEditorPane pane = new JEditorPane();
        JFrame f = new JFrame();
        f.addWindowListener (new WindowAdapter () {
          public void windowClosing (WindowEvent evt) {
            System.exit(0);
          }
        });
    
        f.getContentPane().add(new JScrollPane(pane));
        f.setSize(500, 500);
        f.setVisible(true);

        // Key listener that debugs the key events
        // being sent to the pane
        pane.addKeyListener(
            new KeyListener() {
                public void keyPressed(KeyEvent e) {
                    debugKeyEvent(e);
                }
                
                public void keyReleased(KeyEvent e) {
                    debugKeyEvent(e);
                }
                
                public void keyTyped(KeyEvent e) {
                    debugKeyEvent(e);
                }
            }
        );
    }

    private static void debugKeyEvent(KeyEvent e) {
        System.err.println(e.paramString());
        System.err.println("---------------------------------");
    }

}


---------- END SOURCE ----------

Release Regression From : 1.3.1_03
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

(Review ID: 158480) 
======================================================================

Comments
EVALUATION I tried this on hopper build 15 with winnt. After pressing alt-left, much to my surprise, the JEditorPane contained a comma. The following output was sent to the terminal window: [H:/tests/4708221] J:/jdk1.4.1/windows-i586/bin/java KeyEventTest KEY_PRESSED,keyCode=18,keyChar='?',modifiers=Alt,extModifiers=Alt,keyLocation=KEY_LOCATION_LEFT --------------------------------- KEY_PRESSED,keyCode=37,Left,modifiers=Alt,extModifiers=Alt,keyLocation=KEY_LOCATION_STANDARD --------------------------------- KEY_RELEASED,keyCode=37,Left,modifiers=Alt,extModifiers=Alt,keyLocation=KEY_LOCATION_STANDARD --------------------------------- KEY_RELEASED,keyCode=18,keyChar='?',keyLocation=KEY_LOCATION_LEFT --------------------------------- KEY_TYPED,keyCode=0,keyChar=',',keyLocation=KEY_LOCATION_UNKNOWN --------------------------------- I do not know why the comma appeared, or why there would be a keytyped event. This occurs in 1.4, but not in 1.3.1. I was using the US English input locale. ###@###.### 2002-06-27 When I ran the keylook native C program, and pressed alt, left arrow, I got WM_SYSKEYDOWN 37 WM_SYSKEYDOWN 18 WM_SYSKEYUP 18 WM_KEYUP 37 No WM_CHAR or WM_SYSCHAR messages were observed. ###@###.### 2002-07-08 Sounds like 4737679. ###@###.### 2002-08-27 Alt-left produces a comma Alt-right produces a B Alt-up produces a X Alt-down produces a ? Alt-PageUp produces a c Alt-PageDown produces a ! Alt-Home produces a M Alt-End produces a ? It doesn't matter whether you use the distinct arrow keys or the numpad arrow keys (etc.), the result is the same. ###@###.### 2002-08-28 I wonder if this is related to 4623376 - Alt-Numpad entry of characters? ###@###.### 2002-08-28
28-08-2002