United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 4090407 Could not catch input event via Input Method.
4090407 : Could not catch input event via Input Method.

Details
Type:
Bug
Submit Date:
1997-11-03
Status:
Closed
Updated Date:
1997-11-10
Project Name:
JDK
Resolved Date:
1997-11-10
Component:
client-libs
OS:
generic
Sub-Component:
java.awt
CPU:
generic
Priority:
P3
Resolution:
Won't Fix
Affected Versions:
1.1.2
Fixed Versions:

Related Reports
Relates:

Sub Tasks

Description
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();
  }
}


                                    

Comments
PUBLIC COMMENTS

keyPressed events aren't generated for IME key events.
                                     
2004-06-10
EVALUATION

[joconner@eng 11/10/97]
Can provide a workaround. We don't generate keyPressed events from the IME, however, we do create keyTyped events. See Work Around section.

                                     
97-11-10 00
WORK AROUND

[joconner@eng 11/10/97]
keyPressed events are not generated for IME key events. However, the customer can accomplish the same task (consume characters) in a keyTyped event handler.
                                     
97-11-10 00



Hardware and Software, Engineered to Work Together