Convert keyboard layout from AZERTY to QWERTY
I'm programming in Java using a French machine with an AZERTY keybord. I like to ty开发者_StackOverflowpe text with a certain character, the colon, test: hello
. When I launch the test, only test
is displayed. Are there ways in Java to convert the colon :
to the QWERTY equivalent?
If you are use JSE
,you can use this method :
changLangKeyboardInEN(){
jTextField.getInputContext().selectInputMethod(new Locale("en", "US"));
boolean isOn = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
if (!isOn) {
try {
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_CAPS_LOCK);
robot.keyRelease(KeyEvent.VK_CAPS_LOCK);
} catch (AWTException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
精彩评论