寻找在Java的多媒体键的键code [英] Finding keycode of multimedia key in java

查看:131
本文介绍了寻找在Java的多媒体键的键code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要捕获Windows键presses像FN +暂停,FN + VolumeUp在我的Java应用程序,但我无法检测他们的关键codeS。

I want to capture key presses on Windows like Fn+Pause, Fn+VolumeUp in my Java Application but I am unable to detect their KeyCodes.

addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            System.out.println(e.getKeyCode());
        }
    });

使用此片段为所有多媒体键presses打印0!

Using this snippet it prints 0 for all the Multimedia Key Presses !

请提出一个合适的方法寻找关键code,从而利用它的J​​ava应用程序。

Kindly suggest a suitable method for finding the keyCode and thereby utilizing it in Java Application.

推荐答案

使用 JIntellitype 库。

这API是使用C ++ DLL做的Windows所有通信一个Java JNI库。
这也意味着在其上运行的必须是Windows平台。

This API is a Java JNI library that uses a C++ DLL to do all the communication with Windows. That also means the platform on which you are running must be Windows.

如果你是在Linux中使用 JXGrabKey

If you are in Linux use JXGrabKey

在MacOSX上使用 OSSupport

In MacOSX use OSSupport

这篇关于寻找在Java的多媒体键的键code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆