Can one of the Shift, Ctrl, Alt or Win keys be used in other purpose like, to type text?

走远了吗. 提交于 2019-12-13 00:05:48

问题


I want to modify the use of the one of the Shift, Ctrl, Alt or Win keys. For example, if I just hit (not hold it and press another key) the right shift key, it should do something like displaying a special character in a text box. Could some one let me know if this is possible using any programming language like Java?


回答1:


Yes, you can do that.

Check this tutorial on how to write a Key Listener in Java + Swing.

Another interesting tutorial about Key Bindings in Java + Swing that could also be useful. In order to define special reactions to particular keys use this tutorial.

Hope it helps.




回答2:


It would probably a bit confusing for the user because it is not the usual expected behavior, but you can just wait for a specific key event. If want to map like CTRL + N to create a new file you are doing the same except you are looking for a combination of keys. The concrete implementation depends on what you specific java application you want to develop. But I think the implementation would be a case for SO.



来源:https://stackoverflow.com/questions/20211247/can-one-of-the-shift-ctrl-alt-or-win-keys-be-used-in-other-purpose-like-to-ty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!