import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class WritingText1 extends Applet implements KeyListener {
String msg="";
int x=10,y=20;
public void init()
{
addKeyListener(this);
requestFocus();
}
public void keyTyped(KeyEvent e)
{
msg+=e.getKeyChar();
showStatus("Key pressed");
repaint();
}
public void keyPressed(KeyEvent e)
{
showStatus("Key pressed");
repaint();
}
public void keyReleased(KeyEvent e)
{
showStatus("Key Released");
repaint();
}
public void paint(Graphics g)
{
g.drawString(msg,x,y);
}
}