Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4051910

Win32: Incorrect KeyPressed/Released event generated with input from non-101 Key

XMLWordPrintable

    • 1.1.4
    • generic
    • generic
    • Verified

      AWT component receives an incorrect char code on KeyPressed/Released event
      from inputs made by 106 keyboard which is one of Japanese keyboard type.

      Char code in KeyTyped event is correct though.

      Try the following example to reproduce:

      public class KeyEvents extends Applet implements java.awt.event.KeyListener, java.awt.event.MouseListener
      {
              java.awt.TextArea area;
              java.awt.Canvas canvas;
              public KeyEvents()
              {
              }
              public void init()
              {
                      resize(320, 240);
                      this.setLayout(new java.awt.GridLayout(2,1));
                      this.area = new java.awt.TextArea();
                      this.canvas = new java.awt.Canvas();
                      this.add(area);
                      this.add(canvas);
                      this.canvas.addKeyListener(this);
                      this.canvas.addMouseListener(this);
              }
              public void keyPressed(java.awt.event.KeyEvent event)
              {
                      String message;
                      message=""+event;
                      System.out.println(message);
                      this.area.append(message+" \n");
              }
              public void keyReleased(java.awt.event.KeyEvent event)
              {
                      String message;
                      message=""+event;
                      System.out.println(message);
                      this.area.append(message+" \n");
              }
              public void keyTyped(java.awt.event.KeyEvent event)
              {
                      String message;
                      message=""+event;
                      System.out.println(message);
                      this.area.append(message+" \n");
              }
              public void mouseClicked(java.awt.event.MouseEvent event)
              {
              }
              public void mouseEntered(java.awt.event.MouseEvent event)
              {
              }
              public void mouseExited(java.awt.event.MouseEvent event)
              {
              }
              public void mousePressed(java.awt.event.MouseEvent event)
              {
                      this.canvas.requestFocus();
              }
              public void mouseReleased(java.awt.event.MouseEvent event)
              {
              }

      }

            joconnersunw John Oconner (Inactive)
            sishidasunw Shoji Ishida (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: