Java AWT

Previous Chapter 21
java.awt.event Reference
Next
 

KeyListener (New)

Name

KeyListener (New)

[Graphic: Figure from the text]

Description

Objects that implement the KeyListener interface can receive KeyEvent objects. Listeners must first register themselves with objects that produce events. When events occur, they are then automatically propagated to all registered listeners.

Interface Definition

public abstract interface java.awt.event.KeyListener
   extends java.util.EventListener {
  // Instance Methods
  public abstract void keyPressed (KeyEvent e);
  public abstract void keyReleased (KeyEvent e);
  public abstract void keyTyped (KeyEvent e);
}

Interface Methods

keyPressed

public abstract void keyPressed (KeyEvent e)

Parameters

e

The key event that occurred.

Description

Notifies the KeyListener that a key was pressed.

keyReleased

public abstract void keyReleased (KeyEvent e)

Parameters

e

The key event that occurred.

Description

Notifies the KeyListener that a key was released.

keyTyped

public abstract void keyTyped (KeyEvent e)

Parameters

e

The key event that occurred.

Description

Notifies the KeyListener that a key was typed (pressed and released).

See Also

AWTEventMulticaster, EventListener, KeyEvent, KeyListener


Previous Home Next
KeyEvent (New) Book Index MouseAdapter (New)

Java in a Nutshell Java Language Reference Java AWT Java Fundamental Classes Exploring Java