import java.awt.*;
import java.awt.event.*;
class MyFrame extends Frame
{
MyFrame my;
static Label l;
static TextField t;
static Button b;
static Panel p;
MyFrame(String title)
{
super(title);
setSize(200,200);
setLocation(100,100);
l=new Label("文本文件");
t=new TextField(12);
b=new Button();
b.setLabel("确定");
p=new Panel();
p.add(l);
p.add(t);
p.add(b);
b.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if(e.getSource() instanceof Button)
{
Button bt=(Button)e.getSource();
t.setText("文本文件的显示");
}
}
});
my.add(p);
}
public static void main(String[] args)
{
MyFrame m=new MyFrame("my own");
m.setVisible(true);
}
}