我的问题实际上更笼统,但我使用用户按住“Alt”键并按“+”的操作作为显示困难的示例。
\n\n我正在使用美式英语键盘,该键盘在同一个键上有“=”(小写)和“+”(大写),因此要按“Alt +”(如菜单项中所示),我实际上必须按“Alt Shift =”。在 Java AWT 中,按“Alt Shift =”会生成一个按键 KeyEvent,其键码与“=”键关联,以及一个包含“\xc2\xb1”字符的键类型 KeyEvent。因此,没有明显、可靠的方法来以编程方式确定按下“+”键时按住“Alt”。
\n\n我可以在内部进行一些映射来解决此问题,例如将“\xc2\xb1”映射到“Alt +”,或将“Shift {keycode for = }”映射到“+”。然而,似乎没有任何保证这可以在不同的键盘布局上工作;这当然不是好的编码风格。
\n\n如果有人可以提出解决这些问题的方法,或者指出已经解决了这个困难的代码,我将不胜感激。
\n\n谢谢。
\nGithub有一个功能,你可以在其中放置HTML页面.(详情请点这里).
无论如何,我最近用它来提出上述页面.这样做的说明基础是:
// In order to create a new root branch, first ensure that your working directory is clean by committing or stashing any changes. The following operation will lose any uncommitted files! You might want to run this in a fresh clone of your repo.
$ cd /path/to/fancypants
$ git symbolic-ref HEAD refs/heads/gh-pages
$ rm .git/index
$ git clean -fdx
// After running this you’ll have an empty working directory (don’t worry, your main repo is still …Run Code Online (Sandbox Code Playgroud)