public interface KeyListener extends SWTEventListener
After creating an instance of a class that implements
this interface it can be added to a control using the
addKeyListener
method and removed using
the removeKeyListener
method. When a
key is pressed or released, the appropriate method will
be invoked.
KeyAdapter
,
KeyEvent
Modifier and Type | Method and Description |
---|---|
void |
keyPressed(KeyEvent e)
Sent when a key is pressed on the system keyboard.
|
static KeyListener |
keyPressedAdapter(Consumer<KeyEvent> c)
Static helper method to create a
KeyListener for the
keyPressed(KeyEvent e) ) method with a lambda expression. |
void |
keyReleased(KeyEvent e)
Sent when a key is released on the system keyboard.
|
static KeyListener |
keyReleasedAdapter(Consumer<KeyEvent> c)
Static helper method to create a
KeyListener for the
keyReleased(KeyEvent e) ) method with a lambda expression. |
void keyPressed(KeyEvent e)
e
- an event containing information about the key pressvoid keyReleased(KeyEvent e)
e
- an event containing information about the key releasestatic KeyListener keyPressedAdapter(Consumer<KeyEvent> c)
KeyListener
for the
keyPressed(KeyEvent e)
) method with a lambda expression.c
- the consumer of the eventstatic KeyListener keyReleasedAdapter(Consumer<KeyEvent> c)
KeyListener
for the
keyReleased(KeyEvent e)
) method with a lambda expression.c
- the consumer of the event
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.