Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4090407

Could not catch input event via Input Method.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P3 P3
    • None
    • 1.1.2
    • client-libs
    • 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();
        }
      }

            jdunnsunw Jeffrey Dunn (Inactive)
            nlindenbsunw Norbert Lindenberg (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: