-
Bug
-
Resolution: Fixed
-
P1
-
1.1.3
-
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)
{
}
}
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)
{
}
}
- relates to
-
JDK-4053800 Panel does not accept keys from Japanes Keyboard 106 (on PC)
- Closed