I have a couple of input methods for writing (Traditional Chinese) Taiwanese that come with the Windows 7. Also, all of the input methods have an option to switch the character width (single byte/double byte characters).
- Chinese (Traditional) - New Quick
- Chinese (Traditional) - ChangJie
- Chinese (Traditional) - Quick
- Chinese (Traditional) - Phonetic
- Chinese (Traditional) - New Phonetic
- Chinese (Traditional) - New ChangJie
If I select one of these input methods in Java application and set the character width to half-width(single byte character mode) i can successfully input text in JTextField. But, if the application displays some dialog box (e.g. JOptionPane) or pop up window, the input method character width will automatically change to full-width(double byte character mode). After that, the user must manually toggle to half-width characters.
I can programmatically switch on or off the input method using the Java class "InputContext", but i can't control if the input method is set to full-width/half-width (single/double byte) character mode.
I thought maybe it could be disabled from the Windows input method settings, but there was no option related to automatic switching of the character width.
The question is: Is there a way to handle (disable) this automatic toggling ?
Here is an example code to test this with the above input methods:
public class Example implements ActionListener {
JFrame f = new JFrame("pasod");
JTextField txt = new JTextField();
Button btn = new Button("Locale");
public Example() {
JPanel panel = new JPanel();
panel.setLayout(new GridLayout());
btn.addActionListener(this);
panel.add(btn);
panel.add(txt);
f.add(panel);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setSize(800, 100);
f.setVisible(true);
}
public static void main(String[] args) {
new Example();
}
public void actionPerformed(ActionEvent arg0) {
JOptionPane.showMessageDialog(btn, "Neso", "Neso",
JOptionPane.INFORMATION_MESSAGE);
}
}
Thanks.