I am using a keylistener and I need to know when the backspace and delete keys are used. Does anyone know how this is done? I have not found anything online.
coolbeanbob 17 Junior Poster
Recommended Answers
Jump to PostTry this in your key listener methods. I tested it with keyTyped method
public void keyTyped(KeyEvent ke) { switch(ke.getKeyChar()) { case '\u0008': System.out.println("Backspace"); break; case '\u007F': System.out.println("Delete"); break; default: System.out.println(":)"); break; } }
All 3 Replies
niranga 9 Junior Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
niranga 9 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.