Linux键盘布局

时间:2016-10-18 20:18:44

标签: java linux windows keyboard-events keyboard-layout

我正在使用一个名为JNativehook的java库来接收Lubuntu和Windows上的输入事件,我的问题是当我在Lubuntu上用阿拉伯语键盘布局键入一个字符时,我收到了该键的英文邻居,但是当我使用该库时在Windows上我收到了正确的密钥,为什么会这样?我该如何解决? 这是我的代码:

public void nativeKeyTyped(NativeKeyEvent e)
{
    System.out.println("char: " + e.getKeyChar());
}

我从这里https://oss.sonatype.org/content/repositories/snapshots/com/1stleg/jnativehook/2.1.SNAPSHOT/下载2.1,但问题变得更糟,当我输入一个阿拉伯字符时,我会收到奇怪的字符和很多事件,这只是输出的一小部分

INFO: hook_event_proc [314]: Key 0 typed. (罟)

Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. (ý
Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. (罟)

Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. ()

Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. ()

Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. (
Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. (
Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. (
Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. (
Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. (ý½
Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. (罟)
Char: 

1 个答案:

答案 0 :(得分:1)

问题在于如何在Linux上翻译这些内容,我已经更改了2.1中已解决问题的支持库。