How to detect backspace in a keyTypedEvent
问题 I'm using Netbeans' bean form to create my GUI. I've added a keyTyped event to a JTextArea and I want to detect if the typed key is a Backspace . I'm using keyTyped event for other reasons so I cannot just use the keyPressed event. This is the generated code (and my if check): private void langArea1KeyTyped(java.awt.event.KeyEvent evt) { if(evt.getChar()== backspace) //how can I make this check? } evt.getKeyCode() always returns 0 independent of the typed key. evt.getKeyChar() simply deletes