Hello.
When implementing a KeyListener in my application I have the following code. I have added the KeyListener to a JTextField control using addKeyListener(this) and the current class implements KeyListener.
@Override
public void keyPressed(KeyEvent ev) {
System.out.println("Pressed: "+ev.getKeyCode());
}
@Override
public void keyReleased(KeyEvent ev) {
System.out.println("Released: "+ev.getKeyCode());
}
@Override
public void keyTyped(KeyEvent ev) {
System.out.println("Typed: "+ev.getKeyCode());
}
When I go about typing in this specific JTextField, the keyPressed and keyReleased methods print out the key code results as expected, but the keyTyped event prints out "Typed: 0" on every key.
Why is this?
Thanks.