用户操作
[即时聊天] [发私信] [加为好友]
buckwmm
最近评论
文章分类
    收藏
      相册
      存档
      软件项目交易
      订阅我的博客
      XML聚合  FeedSky
      订阅到鲜果
      订阅到Google
      订阅到抓虾
      订阅到BlogLines
      订阅到Yahoo
      订阅到GouGou
      订阅到飞鸽
      订阅到Rojo
      订阅到newsgator
      订阅到netvibes

      原创 用JAVA写的电子书切割器 欢迎修改意见至wmm204@126.com 收藏

      新一篇: CLASS文件不能转换EXE文件 太让人失望了 | 

       /*下面是电子书切割器源代码 被切割文件要和切割器在同一目录*/import java.awt.*;import java.awt.event.*;import java.io.*;public class TextCut extends Frame implements ActionListener,WindowListener{static TextCut f=new TextCut();static TextField fileName=new TextField("文件名字",20);static TextField fileSize=new TextField("切割后文件大小",20);static Button btn=new Button("开始切割");static String fname=""; static String fsize="";public static void main(String[] args){    f.setSize(200,150);   f.setTitle("my text cut");   f.setLayout(new FlowLayout(FlowLayout.CENTER));   fileName.addActionListener(f);   fileSize.addActionListener(f);   btn.addActionListener(f);                                     f.addWindowListener(f);   f.add(fileSize);   f.add(fileName);   f.add(btn);   f.setVisible(true); }public void textValueChanged(TextEvent e){  }                   public void windowActivated(WindowEvent e) //活动窗口{}public void windowClosed(WindowEvent e) //窗口关闭{}public void windowClosing(WindowEvent e)//按下窗口关闭钮{   f.dispose();   System.exit(0);}public void windowDeactivated(WindowEvent e) //变成非活动窗口{}public void windowDeiconified(WindowEvent e) //窗口还原{}public void windowIconified(WindowEvent e) //窗口最小化{}public void windowOpened(WindowEvent e) //窗口打开{}public void actionPerformed(ActionEvent e){   Button b=(Button)e.getSource();   if(b==btn){   fname=fileName.getText();   fsize=fileSize.getText();   qiege();   }}public static void qiege(){try{     int ch;    int l=Integer.parseInt(fsize);    int len=fname.length();     FileInputStream fin=new FileInputStream(fname);       for(int j=1;j>0;j++)      {      if(fin.read()==-1)   break;           else{        StringBuffer newName=new StringBuffer(fname);        newName.insert((len-4),String.valueOf(j));        String Name=new String(newName);        for(int i=0;i<l;i++){        ch=fin.read();     FileOutputStream fout=new FileOutputStream(Name,true);     fout.write(ch);        }          }          }    }catch(Exception e){}}} 正学到java输入与输出流 就写了这个东西 想挑战下自己从构思到写好花了1星期。高手别笑 ,小弟才学的java。虽然界面还是很粗糙的,可修改的地方也很多,我还是蛮高兴的。切割后会有乱码,是为什么啊?欢迎批评和指点!!

      发表于 @ 2008年05月09日 20:35:28|评论(loading...)|编辑

      新一篇: CLASS文件不能转换EXE文件 太让人失望了 | 

      评论:没有评论。

      发表评论  


      当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
      Csdn Blog version 3.1a
      Copyright © buckwmm