开发者

Convert keyboard layout from AZERTY to QWERTY

开发者 https://www.devze.com 2022-12-25 05:46 出处:网络
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 d

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

精彩评论

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

关注公众号