快速业务通道

用Java编写的记事本程序 - 编程入门网

作者 佚名技术 来源 NET编程 浏览 发布时间 2012-06-20
OLD; FontSet fs=new FontSet(frame,"字体设置",true); fs.show(); if(fs.flag){ switch(fs.font2()){ case 0:type=Font.PLAIN;break; case 1:type=Font.ITALIC;break; case 2:type=Font.BOLD; break; case 3:type=Font.ROMAN_BASELINE;break; default:type=Font.PLAIN;break; } Font f=new Font(fs.font1(),type,16); this.text.setFont(f); }else{ this.text.setFont(cur); } } public void Format_color_actionPerformed(ActionEvent e){ // 颜色 Color current=this.text.getForeground(); this.jColor.setColor(current); this.text.setForeground( this.jColor.showDialog(text,"选择颜色",current)); } //////////////////// Help ///////////////////////////////////// public void Help_about_actionPerformed(ActionEvent e){ //关于作者 new AboutDlg(); } //////////////////////////////////////////////////////// public void pop_undo_actionPerformed(ActionEvent e){ //Pop undo this.undo(); } public void pop_cut_actionPerformed(ActionEvent e){ //pop cut this.cut(); } public void pop_copy_acionPerformed(ActionEvent e){ //pop copy this.copy(); } public void pop_paste_actionPerformed(ActionEvent e){ //pop paste this.paste(); } public void pop_delete_actionPerformed(ActionEvent e){ //pop delete this.delete(); } /************************************************************ ///////////////////////////////////////////////////////////// ////////////// coustm function /////////////////////////////// ///////////////////////////////////////////////////////////// ************************************************************/ void close(){ if(this.dirty){ Dlgtext Dt=new Dlgtext(frame,"提示",true); Dt.show(); if(Dt.getCheck()){ this.save(); } else { frame.dispose(); System.exit(0); } }else{ frame.dispose(); System.exit(0); } } void newtext(){//新建 if((!this.dirty)||(!this.saveas())){ this.text.setText(""); this.text.setFocusable(true); this.frame.setTitle("未命名-----Author:Jeason"); this.statubar.setText("新建文本"); } else this.saveas(); } void opentext(){//打开 // String strFileOpen=""; if(!this.dirty){ try{ if(this.jFileChooser1.APPROVE_OPTION== this.jFileChooser1.showOpenDialog(frame)){ strFileOpen=this.jFileChooser1.getSelectedFile().getPath(); File file=new File(strFileOpen); int flength=(int)file.length(); int num=0; FileReader fReader=new FileReader(file); char[] data=new char[flength]; while(fReader.ready()){ num+=fReader.read(data,num,flength-num); } fReader.close(); this.text.setText(new String(data,0,num)); this.filename=strFileOpen; this.frame.setTitle(this.filename); this.statubar.setText("Open File:"+this.filename); this.dirty=false; }else { return ; } }catch(Exception e){ this.statubar.setText("Error Open:"+e.getMessage()); } }else{ this.save(); } } boolean save(){//保存 if(this.dirty){ if(this.filename.length()!=0){ try{ File saveFile=new File(this.filename); FileWriter fw=new FileWriter(saveFile); fw.write(this.text.getText()); fw.close(); this.dirty=false; this.statubar.setText("保存文件:"+this.f

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号