How to allow configurable shortcuts for all languages, i.e. how to map unicode keystrokes to javax.swing.KeyStroke?

喜欢而已 提交于 2019-12-25 06:37:30

问题


I want to allow a shortcut configuration for my application that works around the world. That's why I load them from resource bundles. I first wanted to simply put the resource value for the shortcut directly to javax.swing.KeyStroke.getKeyStroke(String), but that doesn't work for unicode keyboards, e.g. arabic:

KeyStroke test = KeyStroke.getKeyStroke("control ش");
// test is null, i.e. it did not work

ش is the arabic keyboard key of A.

Is there a easy way to allow String definition of international keystrokes for java?


回答1:


It does not work with pressed keystrokes:

KeyStroke test = KeyStroke.getKeyStroke("control typed ش");
// test not null, works


来源:https://stackoverflow.com/questions/22807892/how-to-allow-configurable-shortcuts-for-all-languages-i-e-how-to-map-unicode-k

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!