[手机短信编程] JAVA_精通swing程序设计

[复制链接]
发表于 2022-9-28 11:18:33
1.KeyEvent类还有两个方法也常常被用到,那就是getKeyCode()与getKeyModifiersText(intmodifiers).键盘上每一个按钮都有对应码(Code),可用来查知用户按了啥键,如[Shift]键code为16。使用getKeyCode()方法就可以得知这个码,不过读者要注意,这个方法在keyTyped()上是无法检测出来的,由于keyTyped()只管用户输入的字符,而不会管到键盘的对应码,算是管理比较高层事情的方法。也就是说keyTyped()方法是keyboadindependent,由于不一样的键盘可能有不一样的对应码(如WindowsU.S.keyboard与windowsFrenchkeyboard就有不一样的对应码)。因而你必定要将getKeyCode()方法写在keyPressed()或keyReleased()方法中才会有效,由于这两个方法是管理比较低层的方法。
JAVA_精通swing程序设计.chm

(1. There are also two methods in the KeyEvent class that are often used, namely getKeyCode() and getKeyModifiersText(intmodifiers). Each button on the keyboard has a corresponding code (Code), which can be used to find out what key the user has pressed, such as The [Shift] key code is 16. This code can be obtained by using the getKeyCode() method, but the reader should note that this method cannot be detected on keyTyped(), because keyTyped() only cares about the characters entered by the user, but not the corresponding code of the keyboard. It's a way to manage things at a higher level. That is to say, the keyTyped() method is keyboadindependent, because different keyboards may have different corresponding codes (for example, WindowsU.S.keyboard and windowsFrenchkeyboard have different corresponding codes). Therefore, you must write the getKeyCode() method in the keyPressed() or keyReleased() method to be effective, because these two methods are relatively low-level management methods.
JAVA_Proficient in swing programming.chm)

[下载]11183317835.rar




上一篇:MyEclipse优化.pdf
下一篇:freemarker入门讲解

使用道具 举报

Archiver|手机版|小黑屋|吾爱开源 |网站地图

Copyright 2011 - 2012 Lnqq.NET.All Rights Reserved( ICP备案粤ICP备14042591号-1粤ICP14042591号 )

关于本站 - 版权申明 - 侵删联系 - Ln Studio! - 广告联系

本站资源来自互联网,仅供用户测试使用,相关版权归原作者所有

快速回复 返回顶部 返回列表