java文件的拆分与合并
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import
import javax.swing.event.*;
public class Application1 extends JFrame {
String filepath="";
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,th is.getToolkit().getScreenSize().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 BorderLayout());
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.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);//选择要拆分的文件
}
});
splitPane1.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() {//给输入框添加事件
public void changedUpdate(DocumentEvent e) {
if(!Application1.this.SplitTotalCount.isFocusOwner())return;
try{SplitTotalCount_changedUpdate(e);}catch(Exception
ex){System.err.println(ex.toString());}
}
public void insertUpdate(DocumentEvent e) {
if(!Application1.this.SplitTotalCount.isFocusOwner())return;
try{SplitTotalCount_changedUpdate(e);}catch(Exception
ex){System.err.println(ex.toString());}
}
public void removeUpdate(DocumentEvent e) {
if(!Application1.this.SplitTotalCount.isFocusOwner())return;
try{SplitTotalCount_changedUpdate(e);}catch(Exception
ex){System.err.println(ex.toString());}
}
});
splitPane3.add(SplitTotalCount);
splitPane4.add(new JLabel("单文件大小:"));
SplitEachSize=new JTextField(15);
SplitEachSize.setDocument(new NumberDocument());//限制输入框只能输入数字SplitEachSize.getDocument().addDocumentListener(new DocumentListener() {//给输入框添加事件
public void changedUpdate(DocumentEvent e) {
if(!Application1.this.SplitEachSize.isFocusOwner())return;
try{SplitEachSize_changedUpdate(e);}catch(Exception
ex){System.err.println(ex.toString());}