import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*; 
public class xiong extends Frame implements ActionListener
{ Vector string=new Vector();
Label l1=new Label("输入信息");
Label l2=new Label("显示信息");
TextField t1=new TextField(20);
TextArea t2=new TextArea(20,30);
Button b1=new Button("save");
Button b2=new Button("exit");
Button b3=new Button("add");
Button b4=new Button("open");
Panel p=new Panel();
public xiong()
{
setSize(200,300);
setLayout(new GridLayout(5,1));
add(l1);
add(t1);
add(l2); 
add(t2);
p.setLayout(new FlowLayout());
p.add(b1);
p.add(b2);
p.add(b3);
p.add(b4);
add(p);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
setVisible(true);}
public static void main(String [] args)
{
new xiong();}public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b2)
System.exit(0);
if(e.getSource()==b3)
{
String str=t1.getText();
if(str==null)
return ;
else
{
t2.append(str);
string.addElement(str);
}
}
if(e.getSource()==b4)
{//try{
FileInputStream booklist=new FileInputStream("E:\\b.txt");
BufferedReader in=new BufferedReader( new InputStreamReader(booklist));
for(int i=0;;)
{
String book=in.readLine();
if(book==null) break;
else
{
t2.append(book+"\n");
book=book;
string.addElement(book);
}
in.close();
booklist.close();
}
// catch(FileNotFoundException eee)
//{eee.printStackTrace();}
//catch(IOException e)
//{e.printStackTrace();}
}
if(e.getSource()==b1){
//try{
FileOutputStream booklist=new FileOutputStream("E:\\b.txt");
BufferedWriter out=new BufferedWriter(new OutputStreamWrite(booklist));
for(int i=0;i<string.size();i++)
{
String book=new string.elementAt(i).toString();
out.write(book+"\n");
}
out.close();
booklist.close();
//}
// catch(FileNotFoundException ee)
// {
// ee.printStackTrace();} 
} }
}book=new string.elementAt(i).toString();这有错误吗