简易写字板软件设计实验报告(编辑修改稿)内容摘要:

((,))。 paste1=new JMenuItem(粘贴 )。 ((,))。 (copy1)。 (cut1)。 (paste1)。 (this)。 (this)。 (this)。 (this)。 (this)。 (this)。 (this)。 (this)。 (this)。 (this)。 (this)。 (this)。 (this)。 (this)。 //(this)。 华北科技学院计算机学院 综合性实验报告 第 12 页 validate()。 (new MouseAdapter(){ public void mousePressed(MouseEvent e){ if(()==){ (area,(),())。 } } })。 } //新建 public void newfile(){ if(!().equals()){ int t=(this, 是 否 保 存。 , 提 示 保 存,)。 if(t==){ save()。 setTitle(无标题 写字板 )。 ()。 } if(t==){ setTitle(无标题 写字板 )。 ()。 } } } //打开 public void open(){ (null)。 int n=(null)。 if(n==){ 华北科技学院计算机学院 综合性实验报告 第 13 页 File file1=()。 setTitle(())。 try{ FileReader readerfile=new FileReader(file1)。 BufferedReader in=new BufferedReader(readerfile)。 String s=null。 while((s=())!=null){ (s+\n)。 } } catch(IOException ee){} } } //保存 public void save(){ int n=(null,另存为 )。 if(n==){ File file2=()。 if(!()){ setTitle(())。 try{ FileWriter writerfile=new FileWriter(file2)。 BufferedWriter out=new BufferedWriter(writerfile)。 (())。 ()。 ()。 } catch(IOException eee){} } else{ 华北科技学院计算机学院 综合性实验报告 第 14 页 int m=(this,()+\n+已存在,是否要覆盖。 ,确认另存为 , )。 if(m==){ setTitle(())。 try{ FileWriter writerfile=new FileWriter(file2)。 BufferedWriter out=new BufferedWriter(writerfile)。 (())。 ()。 ()。 ()。 } catch(IOException eee){} } } } } public void actionPerformed(ActionEvent e){ String content=()。 //得到文本域中的内容 if(()==newfile){ newfile()。 } if(()==open){ open()。 } 华北科技学院计算机学院 综合性实验报告 第 15 页 if(()==save){ if(getTitle().equals(无标题 写字板 )){ save()。 } else{ File file1=()。 if(()){ try{ FileWriter writerfile=new FileWriter(file1)。 BufferedWriter out=new BufferedWriter(writerfile)。 (())。 ()。 ()。 ()。 }。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。