⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menu.java

📁 Java文件分割合并工具,能实现文件的合并与分割.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.util.*;
public class Menu {   
    static File cunDir=new File("d:\\");   
    static File[] fl;   
    static File[] chuanFile;   
    //static File yFile;   
    //static File fMuLu;   
    static  File fenGeFile;   
    static  File cunMuLu;   
    private JFrame jFrame = null;  //  @jve:decl-index=0:visual-constraint="64,31"   
    private JTabbedPane jTabbedPane = null;   
    private JPanel jPanel = null;   
    private JPanel jPanel1 = null;   
    private JLabel jLabel = null;   
    private JTextField jTextField = null;   
    private JButton jButton = null;   
    private JLabel jLabel1 = null;   
    private JTextField jTextField1 = null;   
    private JButton jButton1 = null;   
    private JLabel jLabel2 = null;   
    private JTextField jTextField2 = null;   
    private JLabel jLabel3 = null;   
    private JButton jButton2 = null;   
    private JButton jButton3 = null;   
    private JButton jButton4 = null;   
    private JButton jButton5 = null;   
    private JFileChooser jFileChooser = null;   
    private JFileChooser jFileChooser1 = null;   
    private JScrollPane jScrollPane = null;   
    private JLabel jLabel4 = null;   
    private JTextArea jTextArea = null;   
    private JButton jButton6 = null;   
    private JLabel jLabel41 = null;   
    private JComboBox jComboBox = null;   
    private JTextField jTextField3 = null;   
    private JButton jButton7 = null;   
    /**  
     * This method initializes jFrame     
     *    
     * @return javax.swing.JFrame     
     */  
    private JFrame getJFrame() {   
        if (jFrame == null) {   
            jFrame = new JFrame("分割合并工具");   
            jFrame.setSize(new Dimension(361, 274));   
            jFrame.setContentPane(getJTabbedPane());   
            jFrame.setVisible(true);   
            jFrame.setLocation(300,300);   
            jFrame.setDefaultCloseOperation(jFrame.EXIT_ON_CLOSE);   
        }   
        return jFrame;   
    }   
  
    /**  
     * This method initializes jTabbedPane    
     *    
     * @return javax.swing.JTabbedPane    
     */  
    private JTabbedPane getJTabbedPane() {   
        if (jTabbedPane == null) {   
            jTabbedPane = new JTabbedPane();   
            jTabbedPane.addTab("分割", getJPanel());   
            jTabbedPane.addTab("合并", getJPanel1());   
        }   
        return jTabbedPane;   
    }   
  
    /**  
     * This method initializes jPanel     
     *    
     * @return javax.swing.JPanel     
     */  
    private JPanel getJPanel() {   
        if (jPanel == null) {   
            jLabel3 = new JLabel();   
            jLabel3.setBounds(new Rectangle(283, 106, 51, 18));   
            jLabel3.setText("M");   
            jLabel2 = new JLabel();   
            jLabel2.setBounds(new Rectangle(11, 103, 87, 28));   
            jLabel2.setText("分割大小");   
            jLabel1 = new JLabel();   
            jLabel1.setBounds(new Rectangle(11, 60, 83, 28));   
            jLabel1.setText("存储目录");   
            GridBagConstraints gridBagConstraints = new GridBagConstraints();   
            gridBagConstraints.gridx = 0;   
            gridBagConstraints.gridy = 0;   
            jLabel = new JLabel();   
            jLabel.setText("源文件");   
            jLabel.setBounds(new Rectangle(11, 16, 76, 33));   
            jPanel = new JPanel();   
            jPanel.setLayout(null);   
            jPanel.add(jLabel, gridBagConstraints);   
            jPanel.add(getJTextField(), null);   
            jPanel.add(getJButton(), null);   
            jPanel.add(jLabel1, null);   
            jPanel.add(getJTextField1(), null);   
            jPanel.add(getJButton1(), null);   
            jPanel.add(getJFileChooser(), null);   
            jPanel.add(jLabel2, null);   
            jPanel.add(getJTextField2(), null);   
            jPanel.add(jLabel3, null);   
            jPanel.add(getJButton2(), null);   
            jPanel.add(getJButton3(), null);   
        }   
        return jPanel;   
    }   
  
    /**  
     * This method initializes jPanel1    
     *    
     * @return javax.swing.JPanel     
     */  
    private JPanel getJPanel1() {   
        if (jPanel1 == null) {   
            jLabel41 = new JLabel();   
            jLabel41.setBounds(new Rectangle(164, 3, 108, 22));   
            jLabel41.setText("合并后文件后缀:");   
            jPanel1 = new JPanel();   
            jPanel1.setLayout(null);   
            jPanel1.add(getJButton4(), null);   
            jPanel1.add(getJButton5(), null);   
            jPanel1.add(getJFileChooser1(), null);   
            jPanel1.add(getJScrollPane(), null);   
            jPanel1.add(getJButton6(), null);   
            jPanel1.add(jLabel41, null);   
            jPanel1.add(getJComboBox(), null);   
            jPanel1.add(getJTextField3(), null);   
            jPanel1.add(getJButton7(), null);   
        }   
        return jPanel1;   
    }   
  
    /**  
     * This method initializes jTextField     
     *    
     * @return javax.swing.JTextField     
     */  
    private JTextField getJTextField() {   
        if (jTextField == null) {   
            jTextField = new JTextField();   
            jTextField.setBounds(new Rectangle(105, 16, 165, 25));   
        }   
        return jTextField;   
    }   
  
    /**  
     * This method initializes jButton    
     *    
     * @return javax.swing.JButton    
     */  
    private JButton getJButton() {   
        if (jButton == null) {   
            jButton = new JButton("...");   
            jButton.setBounds(new Rectangle(285, 16, 35, 30));   
            jButton.addActionListener(new java.awt.event.ActionListener() {   
                public void actionPerformed(java.awt.event.ActionEvent e) {   
                    System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()   
                    jFileChooser.setMultiSelectionEnabled(false);   
                    jFileChooser.setFileSelectionMode(0);   
                    int state=jFileChooser.showOpenDialog(null);   
                    System.out.println("state="+state);   
                    //File fy=jFileChooser.getSelectedFile();   
                    if(state==0){   
                        fenGeFile=jFileChooser.getSelectedFile();   
                        jTextField.setText(fenGeFile.getAbsolutePath());   
                    }   
                }   
            });   
        }   
        return jButton;   
    }   
  
    /**  
     * This method initializes jTextField1    
     *    
     * @return javax.swing.JTextField     
     */  
    private JTextField getJTextField1() {   
        if (jTextField1 == null) {   
            jTextField1 = new JTextField();   
            jTextField1.setBounds(new Rectangle(105, 60, 165, 25));   
        }   
        return jTextField1;   
    }   
  
    /**  
     * This method initializes jButton1   
     *    
     * @return javax.swing.JButton    
     */  
    private JButton getJButton1() {   
        if (jButton1 == null) {   
            jButton1 = new JButton("...");   
            jButton1.setBounds(new Rectangle(285, 60, 35, 30));   
            jButton1.addActionListener(new java.awt.event.ActionListener() {   
                public void actionPerformed(java.awt.event.ActionEvent e) {   
                    System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()   
                    jFileChooser.setMultiSelectionEnabled(false);   
                    jFileChooser.setFileSelectionMode(1);   
                    int state=jFileChooser.showOpenDialog(null);   
                    if(state==0){   
                        cunMuLu=jFileChooser.getSelectedFile();   
                        System.out.println("****"+cunMuLu.getAbsolutePath());   
                        jTextField1.setText(cunMuLu.getAbsolutePath());   
                    }   
                }   
            });   
        }   
        return jButton1;   
    }   
  
    /**  
     * This method initializes jTextField2    
     *    
     * @return javax.swing.JTextField     
     */  
    private JTextField getJTextField2() {   
        if (jTextField2 == null) {   
            jTextField2 = new JTextField(5);   
            jTextField2.setBounds(new Rectangle(105, 104, 165, 25));   
        }   
        return jTextField2;   
    }   
  
    /**  
     * This method initializes jButton2   
     *    
     * @return javax.swing.JButton    
     */  
    private JButton getJButton2() {   
        if (jButton2 == null) {   
            jButton2 = new JButton("分割");   
            jButton2.setBounds(new Rectangle(11, 152, 135, 45));   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -