ImageVerifierCode 换一换
格式:DOCX , 页数:9 ,大小:17.86KB ,
资源ID:17080314      下载积分:12 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/17080314.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(java文件的拆分与合并Word格式文档下载.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

java文件的拆分与合并Word格式文档下载.docx

1、;JLabel splitSourceSize,coalitionTotalSize,coalitionTotalCount;JTextField SplitSource,SplitTotalCount,SplitEachSize,coalitionSource;/*申明结束public Application1() super(工具);this.setSize(640,480);this.setLocation(this.getToolkit().getScreenSize().width/2-this.getWidth()/2,this.getToolkit().getScreenSize

2、().height/2-this.getHeight()/2);JPanel contentPanel=(JPanel)this.getContentPane();contentPanel.setLayout(new BorderLayout();JTabbedPane jtp=new JTabbedPane();jtp.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);JPanel splitPane=new JPanel(new GridLayout(5,1);JPanel splitPane0=new JPanel(new BorderL

3、ayout();splitPane0.add(splitPane,BorderLayout.NORTH);JPanel splitPane1=new JPanel(new FlowLayout(FlowLayout.LEADING);JPanel splitPane2=new JPanel(new FlowLayout(FlowLayout.LEADING);JPanel splitPane3=new JPanel(new FlowLayout(FlowLayout.LEADING);JPanel splitPane4=new JPanel(new FlowLayout(FlowLayout.

4、LEADING);JPanel splitPane5=new JPanel();splitPane1.add(new JLabel(拆分源文件:);SplitSource=new JTextField(40);splitPane1.add(SplitSource);JButton SplitJButton=new JButton(浏览.SplitJButton.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) SplitJButtonClick(e);/选择要拆分的文件 );spl

5、itPane1.add(SplitJButton);splitSourceSize=new JLabel(源文件大小:splitPane2.add(splitSourceSize);splitPane3.add(new JLabel(拆分的数目:SplitTotalCount=new JTextField(15);SplitTotalCount.setDocument(new NumberDocument();/限制输入框只能输入数字SplitTotalCount.getDocument().addDocumentListener(new DocumentListener() /给输入框添加事

6、件 public void changedUpdate(DocumentEvent e) if(!Application1.this.SplitTotalCount.isFocusOwner()return; trySplitTotalCount_changedUpdate(e);catch(Exception ex)System.err.println(ex.toString(); public void insertUpdate(DocumentEvent e) public void removeUpdate(DocumentEvent e) splitPane3.add(SplitTo

7、talCount);splitPane4.add(new JLabel(单文件大小:SplitEachSize=new JTextField(15);SplitEachSize.setDocument(new NumberDocument();SplitEachSize.getDocument().addDocumentListener(new DocumentListener() /给输入框添加事件Application1.this.SplitEachSize.isFocusOwner()return; trySplitEachSize_changedUpdate(e);splitPane4

8、.add(SplitEachSize);JButton SplitJB=new JButton(开始拆分SplitJB.addActionListener(new ActionListener() trySplitJBClick(e);/a href=keyword=拆分文件拆分文件splitPane5.add(SplitJB);splitPane.add(splitPane1);splitPane.add(splitPane2);splitPane.add(splitPane3);splitPane.add(splitPane4);splitPane.add(splitPane5);JPan

9、el coalitionPane0=new JPanel(new BorderLayout();JPanel coalitionPane=new JPanel(new GridLayout(4,1);coalitionPane0.add(coalitionPane,BorderLayout.NORTH);JPanel coalitionPane1=new JPanel(new FlowLayout(FlowLayout.LEADING);JPanel coalitionPane2=new JPanel(new FlowLayout(FlowLayout.LEADING);JPanel coal

10、itionPane3=new JPanel(new FlowLayout(FlowLayout.LEADING);JPanel coalitionPane4=new JPanel();coalitionPane1.add(new JLabel(合并首文件:coalitionSource=new JTextField(40);coalitionPane1.add(coalitionSource);JButton coalitionJButton=new JButton(浏览(*.000)coalitionJButton.addActionListener(new ActionListener()

11、 coalitionJButtonClick(e);/选择要合并的首文件coalitionPane1.add(coalitionJButton);coalitionPane.add(coalitionPane1);coalitionTotalSize=new JLabel(文件总大小:coalitionPane2.add(coalitionTotalSize);coalitionPane.add(coalitionPane2);coalitionTotalCount=new JLabel(文件总数目:coalitionPane3.add(coalitionTotalCount);coaliti

12、onPane.add(coalitionPane3);JButton coalitionJB=new JButton(开始合并coalitionJB.addActionListener(new ActionListener() trycoalitionJBClick(e);keyword=合并文件合并文件coalitionPane4.add(coalitionJB);coalitionPane.add(coalitionPane4);jtp.add(,splitPane0);,coalitionPane0);contentPanel.add(jtp,BorderLayout.CENTER);t

13、his.addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) System.exit(0);/当关闭窗口时退出系统this.setVisible(true);/*以上为图形界面设计 private void SplitJBClick(ActionEvent e) throws Exception /操作 File file=new File(this.SplitSource.getText();file.exists() JOptionPane.showMessageDialog(this,

14、源文件不存在!,警告,JOptionPane.WARNING_MESSAGE); return; javax.swing.JFileChooser fjc; fjc=new javax.swing.JFileChooser(filepath); fjc.removeChoosableFileFilter(fjc.getAcceptAllFileFilter(); fjc.setDialogTitle(选择保存目录 fjc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if(fjc.APPROVE_OPTION!=fjc.showOpe

15、nDialog(this)return; filepath=fjc.getSelectedFile().getPath(); byte b=new byte1024; int read=0; String splitfilename=file.getName(); int eachfilesize=Integer.parseInt(this.SplitEachSize.getText(); FileInputStream fis=new FileInputStream(file); FileOutputStream fos; String savesplitfilename= for(long

16、 splitcount=0;splitcount0) fos.write(b,0,read); fos.flush(); hasread+=read; if(hasread=eachfilesize&splitcount!=Long.parseLong(this.SplitTotalCount.getText()-1) break; if(eachfilesize-hasread(long)b.length) eachread=eachfilesize-hasread; fos.close(); fos=null;拆分完成private void coalitionJBClick(Action

17、Event e) throws Exception / File file=new File(this.coalitionSource.getText(); String selfilename=file.getName(); selfilename=selfilename.substring(0,selfilename.lastIndexOf(. String savefile=fjc.getSelectedFile().getAbsolutePath()+selfilename.substring(0,selfilename.lastIndexOf( if(new File(savefil

18、e).exists() int javaok=JOptionPane.showConfirmDialog(this,文件名 +new File(savefile).getName()+ 的文件已经存在,你要覆盖原来的文件吗?警告!,JOptionPane.OK_CANCEL_OPTION); if(javaok=JOptionPane.CANCEL_OPTION)return; FileOutputStream fos=new FileOutputStream(savefile); FileInputStream fis; File f=file.getParentFile().listFil

19、es(); for(int i=0;i fos.write(b, 0, read); fis.close(); fis=null;合并完成private void SplitTotalCount_changedUpdate(DocumentEvent e) throws Exception file.exists()|this.SplitTotalCount.getText().equals()return; long l=Long.parseLong(this.SplitTotalCount.getText(); if(l=0)return; this.SplitEachSize.setText(String.valueOf(file.length()/l);private void SplitEachSize_changedUpdate(DocumentEvent e) throws Exception file.exists()|this.SplitEachSize.

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1