KeyEvent and KeyListener

AWT KeyEvent and KeyListener

Java AWT tracks Keyboard Event through KeyListener. The KeyListener will get the KeyEvent which discloses data of user interaction with the keyboard. For example, it holds what key is typed by the user. The KeyEvent is raised when the user pressed a keyboard key and it also raised when he/she released it. The Event also tells what key is typed by the user. When these actions take place, AWT reports the KeyEvent to KeyListener. The KeyListener receives the KeyEvent on exposed function which tells what action is done by the user. The handler functions exposed by the KeyListener are below: (1) keyPressed(KeyEvent e) (2) keyReleased(KeyEvent e) (3) keyTyped(KeyEvent e) Below picture shows the relation between KeyEvent and KeyListener: