Hi All, I m creating an TextEditor having the track changes feature as in MSWord 2003 ie whenever i make ne changes in the document the changes r highlighted with different color.... also whenever i delete some words it shud be displayed as striked out... this is working for backspace key but not for the delete key... if have used ke.consume() function to capture the delete/backspace key event... its works fine for backspace but not for delete... so plz do the needful its very urgent...
Hi, Thanks for reply, but i have already used the same logic but it is not working my logic is:--
public void keyPressed (KeyEvent ke) { int code=ke.getKeyCode(); if(code==KeyEvent.VK_DELETE && flag==true) consume=true;// used to consumed the key in the keytyped event }
Hi,, thanks for reply. i m damm sure that the flag will become false. flag is used to check the existing file is selected or not (true). The same logic is used for backspace but its working ... public void keyPressed(KeyEvent ke) { int code=ke.getKeyCode(); if(code==KeyEvent.VK_BACK_SPACE && flag==true) consume=true; }
(1) That I needed to add my action listener to the component I'm listening to... (I always forget this)
(2) I need to use KeyEvent.VK_DELETE == e.getKeyChar() instead of KeyEvent.VK_DELETE == e.getKeyCode()
Some new people wait a long time before posting; I think the longest I have seen is a full ten years. But you have gone the other way, finding the solution after eleven years!