Name: rlT66838 Date: 08/12/99
Pressing the '+'-Button, the Programm fires a KeyEvent with
KeyCode==61 (=0x3C), but the class KeyEvent does not contain any constant
VK_xxx=0x3C.
Furthermore VK_PLUS==0x0209
If you type '+' into the TextField, you will see that the KeyCode triggered is 61 while
KeyEvent.VK_PLUS = 521.
----------Test Case---------------
import java.awt.event.*;
import javax.swing.JFrame; ,
import javax.swing.JTextField;
public class KeyBug extends JFrame
{
JTextField feld;
public KeyBug()
{
feld = new JTextField();
feld.addKeyListener(new KeyAdapter()
{
public void keyPressed(KeyEvent evt)
{
System.out.println("KeyCode=" + evt.getKeyCode());
System.out.println("KeyChar=" + evt.getKeyChar());
}
});
this.getContentPane().add(java.awt.BorderLayout.NORTH, feld);
this.pack();
this.show();
}
public static void main(String[] args)
{
System.out.println("PLUS - KeyCode: " + KeyEvent.VK_PLUS);
KeyBug keyBug = new KeyBug();
}
}
(Review ID: 93517)
======================================================================