import java.awt.*;
import java.applet.*;
import java.applet.Applet;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
public class test extends Applet
{
String str=new String();
TextField tf;
Button f;
public void init()
{
tf=new TextField(5);
f=new Button("确定");
add(tf);
this.add(f);
}
public void start()
{
f.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e){methodA();}});
}
public void methodA(){str=tf.getText();}
public void paint(Graphics g)
{g.drawString(str,20,40);}
}