United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7146572 enableInputMethod(false) does not work in the TextArea and TextField on the linux platform
JDK-7146572 : enableInputMethod(false) does not work in the TextArea and TextField on the linux platform

Details
Type:
Bug
Submit Date:
2012-02-17
Status:
Resolved
Updated Date:
2013-07-08
Project Name:
JDK
Resolved Date:
2012-03-06
Component:
client-libs
OS:
generic
Sub-Component:
java.awt
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
8
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Relates:

Sub Tasks

Description
Reported at: http://mail.openjdk.java.net/pipermail/awt-dev/2012-February/002240.html

Given a simple test case below[1], enableInputMethod(false) does not work. We can always invoke input method.
[1]
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.enableInputMethods(false);
    c.setPreferredSize(new Dimension(400, 100));
    add(c);

    c = new TextField("TextField component(No IM)", 52);
    c.enableInputMethods(false);
    add(c);

    setSize(850, 360);
    setVisible(true);

    setDefaultCloseOperation(EXIT_ON_CLOSE);
    }

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

    }
}

                                    

Comments
EVALUATION

Patch submitted: http://mail.openjdk.java.net/pipermail/awt-dev/2012-February/002262.html
                                     
2012-02-17
EVALUATION

http://cr.openjdk.java.net/~littlee/OJDK-124/webrev.01/
                                     
2012-02-21
SUGGESTED FIX

--- old/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java	2012-02-13 15:50:57.166173139 +0800
+++ new/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java	2012-02-13 15:50:56.962172141 +0800
@@ -105,7 +105,6 @@
         this.target = target;
 
         //ComponentAccessor.enableEvents(target,AWTEvent.MOUSE_WHEEL_EVENT_MASK);
-        target.enableInputMethods(true);
 
         firstChangeSkipped = false;
         String text = ((TextArea)target).getText();
@@ -113,7 +112,6 @@
         jtext.setWrapStyleWord(true);
         jtext.getDocument().addDocumentListener(jtext);
         XToolkit.specialPeerMap.put(jtext,this);
-        jtext.enableInputMethods(true);
         textPane = new AWTTextPane(jtext,this, target.getParent());
 
         setBounds(x, y, width, height, SET_BOUNDS);
--- old/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java	2012-02-13 15:50:57.722175858 +0800
+++ new/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java	2012-02-13 15:50:57.518174860 +0800
@@ -73,8 +73,6 @@
         xtext = new XAWTTextField(text,this, target.getParent());
         xtext.getDocument().addDocumentListener(xtext);
         xtext.setCursor(target.getCursor());
-        target.enableInputMethods(true);
-        xtext.enableInputMethods(true);
         XToolkit.specialPeerMap.put(xtext,this);
 
         TextField txt = (TextField) target;
                                     
2012-02-21



Hardware and Software, Engineered to Work Together