• <tfoot id='NOzph'></tfoot>
    1. <legend id='NOzph'><style id='NOzph'><dir id='NOzph'><q id='NOzph'></q></dir></style></legend>
      <i id='NOzph'><tr id='NOzph'><dt id='NOzph'><q id='NOzph'><span id='NOzph'><b id='NOzph'><form id='NOzph'><ins id='NOzph'></ins><ul id='NOzph'></ul><sub id='NOzph'></sub></form><legend id='NOzph'></legend><bdo id='NOzph'><pre id='NOzph'><center id='NOzph'></center></pre></bdo></b><th id='NOzph'></th></span></q></dt></tr></i><div id='NOzph'><tfoot id='NOzph'></tfoot><dl id='NOzph'><fieldset id='NOzph'></fieldset></dl></div>

        <bdo id='NOzph'></bdo><ul id='NOzph'></ul>

        <small id='NOzph'></small><noframes id='NOzph'>

        将键盘事件从 java 发送到任何应用程序(屏幕键盘

        时间:2023-09-27
        • <legend id='1ACW5'><style id='1ACW5'><dir id='1ACW5'><q id='1ACW5'></q></dir></style></legend>
            <i id='1ACW5'><tr id='1ACW5'><dt id='1ACW5'><q id='1ACW5'><span id='1ACW5'><b id='1ACW5'><form id='1ACW5'><ins id='1ACW5'></ins><ul id='1ACW5'></ul><sub id='1ACW5'></sub></form><legend id='1ACW5'></legend><bdo id='1ACW5'><pre id='1ACW5'><center id='1ACW5'></center></pre></bdo></b><th id='1ACW5'></th></span></q></dt></tr></i><div id='1ACW5'><tfoot id='1ACW5'></tfoot><dl id='1ACW5'><fieldset id='1ACW5'></fieldset></dl></div>

            <small id='1ACW5'></small><noframes id='1ACW5'>

              <tbody id='1ACW5'></tbody>

            1. <tfoot id='1ACW5'></tfoot>
                <bdo id='1ACW5'></bdo><ul id='1ACW5'></ul>

                  本文介绍了将键盘事件从 java 发送到任何应用程序(屏幕键盘)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在使用 java 开发屏幕键盘.这个键盘对每个可能的键都有一个 JComponent.当在按钮上检测到鼠标按下时,我想将特定的键盘代码发送到当前处于焦点的应用程序.键盘本身位于 JFrame 内,没有任何装饰,并设置为始终位于顶部.

                  I am working on developing an on-screen keyboard with java. This keyboard has a JComponent for every possible key. When a mouse down is detected on the button, I want to send a specific keyboard code to the application currently on focus. The keyboard itself is within a JFrame with no decorations and set to always-on-top.

                  我发现Robot类可以用来模拟原生队列上的这些键盘事件.但是,在这种情况下,选择 JComponent 将意味着在 JFrame 上接收到按键,而我将无法在其他应用程序中接收到它

                  I found that the Robot class can be used to simulate these keyboard events on the native queue. However, in this case, selecting the JComponent would mean that the key-press is received on the JFrame, and I wouldn't be able to receive it in the other application

                  如何让我的屏幕键盘始终没有焦点"?是否可以使用另一种方法来发送按键?

                  How can I keep my on-screen keyboard "Always-without-focus"? Is it maybe possible to use another approach to send the key-press?

                  推荐答案

                  显然,做到这一点的唯一方法是拥有一个 JNI 层,该层将使从 java 到 native 的转换.Java 没有简单的方法来提供这样的功能.

                  Apparently the only way to do this is to have a JNI layer that will make the conversion from java to native. Java has no easy way to provide such funcionality.

                  对于想要学习 JNI 的小型第三方库来说,这可能是一个有趣的概念...

                  This could be an interesting concept for a small, third party library for someone who wants to learn JNI...

                  这篇关于将键盘事件从 java 发送到任何应用程序(屏幕键盘)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:使用键盘滚动其弹出列表时如何使 JComboBox 所选项 下一篇:如何使用休眠 JPA 注释映射嵌套集合 Map&lt;Ke

                  相关文章

                  最新文章

                    • <bdo id='Sw8du'></bdo><ul id='Sw8du'></ul>

                      <small id='Sw8du'></small><noframes id='Sw8du'>

                      <tfoot id='Sw8du'></tfoot>
                      <i id='Sw8du'><tr id='Sw8du'><dt id='Sw8du'><q id='Sw8du'><span id='Sw8du'><b id='Sw8du'><form id='Sw8du'><ins id='Sw8du'></ins><ul id='Sw8du'></ul><sub id='Sw8du'></sub></form><legend id='Sw8du'></legend><bdo id='Sw8du'><pre id='Sw8du'><center id='Sw8du'></center></pre></bdo></b><th id='Sw8du'></th></span></q></dt></tr></i><div id='Sw8du'><tfoot id='Sw8du'></tfoot><dl id='Sw8du'><fieldset id='Sw8du'></fieldset></dl></div>
                      <legend id='Sw8du'><style id='Sw8du'><dir id='Sw8du'><q id='Sw8du'></q></dir></style></legend>