<AWT Dev> enableInputMethod(false) does not work in the TextArea and TextField on the linux platform

Charles Lee littlee at linux.vnet.ibm.com
Tue Feb 7 01:17:29 PST 2012

Hi guys,

Given a simple test case below[1], enableInputMethod(false) does not 
work. We can always invoke input method.
public class MyAWTTest extends JFrame {
     Component c;

     public MyAWTTest() {
     super("Single Frame --- AWT Frame");

     setLayout(new FlowLayout());

     c = new TextArea("TextArea component(No IM)");
     c.setPreferredSize(new Dimension(400, 100));

     c = new TextField("TextField component(No IM)", 52);

     setSize(850, 360);


     public static void main(String[] args) {
     SwingUtilities.invokeLater(new Runnable() {
         public void run() {
         new MyAWTTest();


Patch @ http://cr.openjdk.java.net/~littlee/OJDK-124/webrev.00/ 

The patch is mainly about:
1. Add a new method in the ComponentAccessor which help to escape the 
package restraints. Please check the changes in Component and AWTAccessor.
2. Remove the enableInputMethod(true) in the XTextAreaPeer and 
XTextFieldPeer and use areInputMethodEnabled to set jtext correctly. 
Please check the changes in XTextAreaPeer and XTextFieldPeer.

I know it may not be a beautiful fix, but anyone interests in it?

Yours Charles

More information about the awt-dev mailing list