J#-文件复制

ylbtech_java

JProgressBar pb = new JProgressBar();//进度条
    //JProgressBar

File f1 = new File(txt1.getText());
                File f2 = new File(txt2.getText());
                
                byte b[] = new byte[1024];
                FileInputStream in = new FileInputStream(f1);
                FileOutputStream out = new FileOutputStream(f2);
                
                while(in.read(b) != -1)
                {
                    out.write(b);
                }
                pb.setMaximum(100);//进度最大值
                pb.setValue(100);//设置当前进度

 

posted on 2014-07-06 23:42  ylbtech  阅读(122)  评论(0编辑  收藏  举报