backspace key « Event « Java Swing Q&A





1. how to redirect backspace key to some other function    coderanch.com

hi, i m creating a textEditor, i stuck in a module. i want to include the 'track changes' facility as in MS-WORD 2003. ie whenever i delete some text they will not physically erased, instead they the text shud be displayed in some other color, with strike out like v do on the notebook. thanks in advace, bye

2. How to track backspace key?    coderanch.com

You can wrap the text fields document in your own class that intercepts the insertString method: class MaxLengthDocument implements Document { private Document document; private int maxLength; public MaxLengthDocument(Document document, int maxLength) { // you should check for null and if maxLength >= 0 this.document = document; this.maxLength = maxLength; } public int getLength() { return document.getLength(); } public Object getProperty(Object ...