Java AWT

Previous Chapter 21
java.awt.event Reference
Next
 

KeyAdapter (New)

Name

KeyAdapter (New)

[Graphic: Figure from the text]

Description

The KeyAdapter class implements the methods of KeyListener with empty functions. It may be easier for you to extend KeyAdapter, overriding only those methods you are interested in, than to implement KeyListener and provide the empty functions yourself.

Class Definition


public abstract class java.awt.event.KeyAdapter

   extends java.lang.Object

   implements java.awt.event.KeyListener {

  // Instance Methods

  public void keyPressed (KeyEvent e);

  public void keyReleased (KeyEvent e);

  public void keyTyped (KeyEvent e);

}

Instance Methods

keyPressed

public void keyPressed (KeyEvent e)

Parameters

e

The event that has occurred.

Description

Does nothing. Override this function to be notified when a key is pressed.

keyReleased

public void keyReleased (KeyEvent e)

Parameters

e

The event that has occurred.

Description

Does nothing. Override this function to be notified when a pressed key is released.

keyTyped

public void keyTyped (KeyEvent e)

Parameters

e

The event that has occurred.

Description

Does nothing. Override this function to be notified when a key has been pressed and released.

See Also

KeyEvent, KeyListener


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

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