<legend id='PDmVn'><style id='PDmVn'><dir id='PDmVn'><q id='PDmVn'></q></dir></style></legend>
    <tfoot id='PDmVn'></tfoot>

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

  • <i id='PDmVn'><tr id='PDmVn'><dt id='PDmVn'><q id='PDmVn'><span id='PDmVn'><b id='PDmVn'><form id='PDmVn'><ins id='PDmVn'></ins><ul id='PDmVn'></ul><sub id='PDmVn'></sub></form><legend id='PDmVn'></legend><bdo id='PDmVn'><pre id='PDmVn'><center id='PDmVn'></center></pre></bdo></b><th id='PDmVn'></th></span></q></dt></tr></i><div id='PDmVn'><tfoot id='PDmVn'></tfoot><dl id='PDmVn'><fieldset id='PDmVn'></fieldset></dl></div>
        <bdo id='PDmVn'></bdo><ul id='PDmVn'></ul>
      1. 如何检查在Java中启动时按住的键

        时间:2023-09-27
        • <bdo id='gSVha'></bdo><ul id='gSVha'></ul>
          <legend id='gSVha'><style id='gSVha'><dir id='gSVha'><q id='gSVha'></q></dir></style></legend>
          1. <tfoot id='gSVha'></tfoot>

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

                    <tbody id='gSVha'></tbody>
                  <i id='gSVha'><tr id='gSVha'><dt id='gSVha'><q id='gSVha'><span id='gSVha'><b id='gSVha'><form id='gSVha'><ins id='gSVha'></ins><ul id='gSVha'></ul><sub id='gSVha'></sub></form><legend id='gSVha'></legend><bdo id='gSVha'><pre id='gSVha'><center id='gSVha'></center></pre></bdo></b><th id='gSVha'></th></span></q></dt></tr></i><div id='gSVha'><tfoot id='gSVha'></tfoot><dl id='gSVha'><fieldset id='gSVha'></fieldset></dl></div>
                  本文介绍了如何检查在Java中启动时按住的键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试编写一个在程序首次启动时弹出的分辨率选择对话框.为了避免让用户感到无聊,我想实现一个相当标准的功能,您可以使用复选框关闭该对话框,但在启动时按住 alt 键将其恢复.

                  I'm trying to write a resolution selection dialog that pops up when a program first starts up. To prevent boring the user, I want to implement the fairly standard feature that you can turn off that dialog with a checkbox, but get it back by holding down the alt key at startup.

                  不幸的是,没有明显的方法可以询问 java 给定的键是否当前被按下.您只能通过 KeyListener 注册以了解新的按键操作,但如果按键在应用启动之前启动,这将无济于事.

                  Unfortunately, there is no obvious way to ask java whether a given key is currently being pressed. You can only register to be informed of new key presses via a KeyListener, but that doesn't help if the keypress starts before the app launches.

                  推荐答案

                  public class LockingKeyDemo {
                      static Toolkit kit = Toolkit.getDefaultToolkit();
                  
                      public static void main(String[] args) {
                          System.out.println("caps lock2 = "
                                  + kit.getLockingKeyState(KeyEvent.VK_CAPS_LOCK));
                  }
                  }
                  

                  这篇关于如何检查在Java中启动时按住的键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Android - 获取键盘按键 下一篇:如何将布局放置在 android 屏幕键盘的正上方?

                  相关文章

                  最新文章

                • <small id='prlm0'></small><noframes id='prlm0'>

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

                      <legend id='prlm0'><style id='prlm0'><dir id='prlm0'><q id='prlm0'></q></dir></style></legend>