import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Blt1 extends JFrame implements ActionListener{
JTextField txt;
public Blt1(){
txt=new JTextField(" Write somthing & press enter");
add(txt);
txt.addActionListener(this);
setSize(200,300);
setVisible(true);
}
public static void main(String args[])
{
Blt1 bt = new Blt1();
bt.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
}
public void actionPerformed(ActionEvent ae)
{
String st=" ";
st=txt.getText()+" ";
JOptionPane.showMessageDialog(null,st);
}
}