• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to trap delete KeyEvent..

danish shaikh
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I m creating a Text Editor in Java..
I m new to Java n learnt by my own.
1> i have to redirect the keyEvent of BackSpace n delete keys..
i have successfully built the logic to redirect the back space key ..
by first consuming it...
But my problem is that the Delete Key event is not consuming
i hav used the same logic for backspace but it working so plz help me
the logic is..
public void keyPressed(KeyEvent ke)
int code=ke.getKeyCode();
if(code==KeyEvent.VK_BACK_SPACE && flag==true)
if(code==KeyEvent.VK_DELETE && flag==true)

2> i also wants to make the deleted word as a striked one but that too is
not working whereas the same for underline attribute is working so plz
help me....

StyleConstants.setUnderline(set, true); /// working
StyleConstants.setStrikeThrough(set,true); ///not working

plz help me its quite urgent...looking for ur replies....
Thanks in Advance...
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic