开发者

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();
                }
            }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜