How to Write a Key Listener
by, 04-26-2012 at 09:33 PM (1169 Views)
Key events are being indicated when user starts typing keyboard. Key events are specifically fired with keyboard focus by the component when keyboard keys are pressed or releaserd. “How Focus Subsytem could be used” shall be read for more information regarding focus.
Regarding 2 key events, the notifications are being sent.
• Unicode character typing
• To pressor release a key present at the keyboard
First event is known as key typed event. Second one is either key release or key pressed event.
Generally, just key typed events would be reacted by you unless you come to know that when keys are pressed by the user doesn’t correspond, to characters. Let us say for example, to be aware that when a Unicode character â€ is typed by the user either by one key press like “a” or several key press sequentially to handle the events which are key typed. Similarly to be aware that user either pressed F1 key or 3 key was pressed at the number pad, key pressed events are handled.