The Ctrl+B in Word and other shortcuts work the same no matter what language I’m using – how is this binding done? Can it be done in Java?
The Ctrl + B in Word and other shortcuts work the same no matter
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If I understand you correctly I wonder that typing Ctrl+B creates different key code when you are using different languages? In this case look into KeyEvent API. It has 2 relevant methods: getKeyCode() and getKeyChar().
getKeyChar() invoked when key is down depends on current language. getKeyCode() does not depend. It always return the code of the key, not the letter associated with it. Moreover I found that (at least on my system – Linux Fedora) getkeyChar() invoked on key released returns the English character even when current language is different.
Here are the results of pressing and releasing of the same key with 3 different input languages installed on my system: English, Russian and Hebrew.
pressed: ф 65
released: a 65
pressed: a 65
released: a 65
pressed: ש 65
released: a 65
As you can see the key code is always the same although the char is different.