import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class WritingText1 extends JFrame {
String msg="";
int x=10,y=20;
JTextArea txt=new JTextArea();
public WritingText1()
{
add(txt);
txt.setEnabled(false);
addKeyListener(new KeyAdpt());
setSize(200,300);
setVisible(true);
}
private class KeyAdpt extends KeyAdapter
{
public void keyTyped(KeyEvent e)
{
msg+=e.getKeyChar();
setTitle("Key pressed");
txt.setText(msg);
}
}
public static void main(String args[])
{
WritingText1 bt = new WritingText1();
bt.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
}
}