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.
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); }
The event that has occurred.
Does nothing. Override this function to be notified when a key is pressed.
The event that has occurred.
Does nothing. Override this function to be notified when a pressed key is released.
The event that has occurred.
Does nothing. Override this function to be notified when a key has been pressed and released.
KeyEvent, KeyListener