如题所示,谢谢高手的帮助。

解决方案 »

  1.   

    public class eg extends Jframe implement ActionLister
    {
        jtextArea text=new Jtextrea(10,10);
        Jbutton button=new Jbutton("保存");
        String file="D:/you.txt";
        public eg()
        {
           this.add(text,Borderlayout.center);
           this.add(button,Borderlayout.south);
           button.AddactionLister(this);
           myget();\\取文件里的内容
           this.sevisable(true);
           this.setdefaultco.........(Jframe.Exitor...);
        }
        public void myget()
        {
           try
             {
             Objectinputstream oi=new Objectinputstream(new Fileinputstrame(file));
             text.settext(oi.readObject().tostring());
             oi.close();
             }
            catch(Ex......... e)
           {        }
        }
        事件实现里这样写(A... e)
       {
           if(e.getActionCommon.equals("保存")
             {
                try
                  {
                  Objectoutputstream oo=new Objectoutputstream(new Fileoutputstrame(file));
                   oo.writerObject(text.gettext());
                  oo.close();
                  }
               catch(Ex......... e)
               {}
            }
       }}