Hi Charles,
The general idea of the fix is OK and the fix looks fine to me.
However, there's still a problem if an app enables or disables Input
Methods dynamically during the app's execution. The updated status of
the property needs to be propagated to the jtext or xtext somehow.
--
best regards,
Anthony
On 2/7/2012 1:17 PM, Charles Lee wrote:
Hi guys,
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();
}
});
}
}
Patch @ http://cr.openjdk.java.net/~littlee/OJDK-124/webrev.00/
<http://cr.openjdk.java.net/%7Elittlee/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?