-
Bug
-
Resolution: Won't Fix
-
P3
-
None
-
1.1.2
-
generic
-
generic
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();
}
}
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();
}
}
- relates to
-
JDK-4040458 Need input method support for lightweight components
- Closed