-
Bug
-
Resolution: Fixed
-
P2
-
1.4.0
-
beta3
-
x86
-
windows_98, windows_nt, windows_2000
-
Verified
Name: bsC130419 Date: 05/31/2001
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
This code work fine with JDK 1.3 but do not work with JDK 1.4b
The KeyAdaptater display 'Instatiated', but nothing more (function arn't called)
The same code works fine on both JDK if KeyAdapater is replaced with a
MouseMoveAdaptater (even without enabling MouseMoveEvents :) )
------------------------------------------------------------------------------
import java.awt.*;
import java.awt.event.*;
public class Tests {
static MainFrame mainFrame = new MainFrame();
public static void main(String[] args) {
mainFrame.setSize(50,50);
mainFrame.addKeyListener(new KeyboardTracker());
mainFrame.show();
}
public Tests() {
}
static public class KeyboardTracker extends KeyAdapter {
public KeyboardTracker() {
System.err.println("Instantiated");
}
public void keyTyped(KeyEvent e) {
System.err.println("typed : " + e.getKeyText
(e.getKeyCode()));
}
public void keyPressed(KeyEvent e) {
System.err.println("pressed : " + e.getKeyText
(e.getKeyCode()));
}
public void keyReleased(KeyEvent e) {
System.err.println("released : " + e.getKeyText
(e.getKeyCode()));
}
}
static public class MainFrame extends Frame {
public MainFrame() {
super();
enableEvents(AWTEvent.KEY_EVENT_MASK);
}
}
}
(Review ID: 125389)
======================================================================
Name: rmT116609 Date: 08/26/2001
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beata-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
//Standard KeyListener that compiles and runs properly with jdk1.3.1
import javax.swing.*;
import java.awt.event.*;
public class TestKey extends JFrame implements KeyListener
{
public TestKey()
{
this.addKeyListener(this);
setSize(400,300);
show();
}
public void keyPressed(KeyEvent ke)
{
System.out.println(ke);
}
public void keyReleased(KeyEvent ke)
{
System.out.println(ke);
}
public void keyTyped(KeyEvent ke)
{
System.out.println(ke);
}
public static void main(String[] args)
{
TestKey tk = new TestKey();
}
}
Whenever I typed anything on the keyboard with 1.3.1, this program would
produce output like this:
java.awt.event.KeyEvent[Key_PRESSED,keyCode=38,Up] on frame 0
java.awt.event.KeyEvent[Key_RELEASED,keyCode=38,Up] on frame 0
However, when compiled with 1.4, it would produce no output at all.
(Review ID: 130690)
======================================================================