Inside the KeyTyped method, how do I tell if Backspace or Esc is being pressed?
I understand this is a very old subject, but I wanted to add an answer that I found helped me greatly with the same issue.
I'm making a chat input for a Java program, and its better to use KeyTyped as opposed to pressed and released (as it excluded the need to filter most characters). Anyways I wanted to make backspace delete characters, but the .getKeyCode() always returned 0 as per the documentation. However, you can use .getKeyChar() to return the character (probably will appear as a square box), and the escape character '\b' to do a comparison.
if(tmp.getKeyChar().equals('\b')) { ... }