Well, I don't understand the question. Lets say you have "123456" displayed in a text field and you type the character "7". What happens:
a) all the text is removed and only a "7" is displayed
b) the "1" is removed so now you have "234567"
c) the "7" is ignored
d) as soon as you type "6" all the characters are removed
> What i want to mean is exactly answer d.:)
Then you should be using a DocumentFilter or DocumentListener (depending on your exact requirements), not a KeyListener.
setText("") should work.
As suggested above, If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",
see http://homepage1.nifty.com/algafield/sscce.html,
that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
Don't forget to use the "Code Formatting Tags",
see http://forum.java.sun.com/help.jspa?sec=formatting,
so the posted code retains its original formatting.