This forum is for J2EE questions, you should post this in the Java forum.
Anyway, I think what you want is a bit tricky, if not impossible.
The only way I see is trying to "print" a backspace that will delete the last written char but that is AFAIK system dependant.
Cheers,
Dian