<Swing Dev> TextArea's/TextField's enableInputMethods is not working on linux

Sean Chou zhouyx at linux.vnet.ibm.com
Thu May 26 07:25:05 UTC 2011


Hi all,

   I found TextArea's/TextField's enableInputMethods is not working on
linux,
even enableInputMethods(false) is invocated, the input method can still be
enabled.  The testcase is as follows:

/*
 * ImfAWTTest.java
 */
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.TextArea;
import java.awt.TextField;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JTextArea;
import javax.swing.JTextField;


public class ImfAWTTest extends Frame {
Component c;
public ImfAWTTest() {
 super("Single Frame --- AWT Frame");
 // set layout here.
 setLayout(new FlowLayout());
 // add components here.
 c = new TextArea("TextArea component(No IM)");
c.enableInputMethods(false);
 c.setPreferredSize(new Dimension(400, 100));
add(c);

c = new JTextArea("JTextArea component");
 c.enableInputMethods(true);
c.setPreferredSize(new Dimension(400, 100));
 add(c);

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

c = new JTextField("JTextField component(No IM)");
 c.enableInputMethods(false);
c.setPreferredSize(new Dimension(400, 20));
 add(c);
 addWindowListener(new WindowAdapter() {
 public void windowClosing(WindowEvent event) {
System.exit(0);
}
 });
setSize(850, 360);
setVisible(true);
 }
 public static void main(String[] args) {
 new ImfAWTTest();
}
}


Reproduce steps are:
1. On linux system, run the testcase with b143.
2.  Click 'TextArea component(No IM)'.
3. Switch Ime window, and type some characters into it

Expectation:
  IME cannot be enabled.
Result:
  IME can be used to input.


Investigation:
   This behavior was developed when Java was using Motif library,
however Java7's
TextArea/TexField does not use Motif any more, so enableInputMethods doesn't
work.


   I suppose we need to update the specification about the behavior.
Any comments?


-- 
Best Regards,
Sean Chou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20110526/79e42ad6/attachment.html>


More information about the swing-dev mailing list