Here is a list of key event listener interfaces in AWT with a single-line example of each:
1. ActionListener: Used to handle action events, such as button clicks.
Example: button.addActionListener(e -> System.out.println("Button clicked!"));
2. MouseListener: Used to handle mouse events, such as clicks and movements.
Example: myComponent.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
System.out.println("Mouse clicked!"); }});
3. KeyListener: Used to handle keyboard events, such as key presses and releases.
Example: myComponent.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
System.out.println("Key pressed!"); }});
4. WindowListener: Used to handle window events, such as opening and closing.
Example: myFrame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.out.println("Window closed!"); }});
5. ComponentListener: Used to handle component events, such as resizing and moving.
Example: myComponent.addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent e) {
System.out.println("Component resized!"); }});