-
Bug
-
Resolution: Fixed
-
P3
-
1.1
-
1.1.8
-
x86
-
windows_95
-
Not verified
Name: clC74495 Date: 02/24/99
With JDK 1.1.8C and later, when I press or release the Return Key
on awt Components, keyDown or KeyUp method receives 13 (CR: Carriage
Return) as a key code.
With JDK 1.1.8B and before, it receives 10 (NL: New Line).
When I use the new event model, keyCode is always 10.
Though this takes place only when using the old event model, it may
cause problems with old application.
==Sample code
import java.awt.*;
public class B extends Frame {
public static void main(String[] args) {
B f = new B();
f.setBounds(100, 100, 100, 100);
f.setVisible(true);
}
public boolean keyDown(Event event, int key) {
System.out.println(event);
System.out.println(key);
return true;
}
public boolean keyUp(Event event, int key) {
System.out.println(event);
System.out.println(key);
return true;
}
}
== Result with JDK 1.1.8H
java.awt.Event[id=401,x=0,y=0,key=13,target=B[frame0,100,100,112x100,layout=java
.awt.BorderLayout,resizable,title=]]
13
java.awt.Event[id=402,x=0,y=0,key=13,target=B[frame0,100,100,112x100,layout=java
.awt.BorderLayout,resizable,title=]]
13
== Result with JDK 1.1.8B
java.awt.Event[id=401,x=0,y=0,key=10,target=B[frame0,100,100,112x100,layout=java
.awt.BorderLayout,resizable,title=]]
10
java.awt.Event[id=402,x=0,y=0,key=10,target=B[frame0,100,100,112x100,layout=java
.awt.BorderLayout,resizable,title=]]
10
(Review ID: 54642)
======================================================================