Create a simple java Application program that implements KeyListener

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Keyinf1 extends JFrame implements KeyListener  {
    public Keyinf1()
    {
        addKeyListener(this);
        setSize(200,300);
        setVisible(true);
    }
    public void keyPressed(KeyEvent e)
    {
        setTitle("Key pressed");
    }
    public void keyReleased(KeyEvent e)
    {
        setTitle("Key Released");
    }
    public void keyTyped(KeyEvent e)
    {
        setTitle("Key Typed");
    }
    public static void main(String args[])
    {
        Keyinf1 bt = new Keyinf1();
        bt.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
    }

}