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