TextField can catch keyinput event if it's made via Input Method.
The following code is to reject an input of "z", if z is inputed from IME/IM
it won;t be consumed.
import java.awt.*;
import java.awt.event.*;
public class EchoChar {
public static void main(String args[]) {
new EchoChar().run();
}
Frame fp;
TextField tf;
void run() {
fp = new Frame("Test");
fp.add(tf = new TextField(50));
tf.addKeyListener(
new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if(e.getKeyChar() == 'Z')
e.consume();
}
}
);
fp.pack();
fp.show();
}
}