public class KeyManager
extends java.lang.Object
The KeyManager
class provides methods to add and remove
KeyListeners
in order to handle key events.
Modifier | Constructor and Description |
---|---|
protected |
KeyManager()
Creates a new instance of KeyManager.
|
Modifier and Type | Method and Description |
---|---|
void |
addKeyListener(KeyListener listener)
Add a
KeyListener to be notified. |
static KeyManager |
getInstance()
Returns the instance of
KeyManager . |
void |
removeKeyListener(KeyListener listener)
Removes a
KeyListener . |
protected KeyManager()
public static KeyManager getInstance()
KeyManager
.KeyManager
.public void addKeyListener(KeyListener listener)
Add a KeyListener
to be notified.
The listener will be notified for any key events created by the input
capabilities of the device.
If the listener is removed using
removeKeyListener
then it will no longer
be notified.
listener
- The listener to add.java.lang.NullPointerException
- If listener
is null
removeKeyListener(KeyListener)
public void removeKeyListener(KeyListener listener)
KeyListener
.
If listener
had not previously been added as a key
listener then the request is ignored.listener
- The listener to remove.java.lang.NullPointerException
- If listener
is null
.addKeyListener(KeyListener)
Copyright (c) 2013, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.