问题
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