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

📄 frameallcheck.java

📁 基于Java的地图数据管理软件。使用MySQL数据库管理系统。
💻 JAVA
字号:
package net.aetherial.gis.our.auto.Frame;

import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import net.aetherial.gis.surface.ItemValue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import net.aetherial.gis.our.FrameOur;
import net.aetherial.gis.our.auto.check.AllCheckFunction;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2004</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class FrameAllCheck
    extends JFrame {
  FrameOur fo = null;
  private String InputPath = "",OutputPath ="";
  private boolean yunxing_fenkai = true,yunxing_hebing = false;
  BorderLayout borderLayout1 = new BorderLayout();
  JLabel jLabel1 = new JLabel();
  JSplitPane jSplitPane1 = new JSplitPane();
  JPanel jPanel1 = new JPanel();
  CheckItem item = new CheckItem();
  JLabel jLabel2 = new JLabel();
  XYLayout xYLayout1 = new XYLayout();
  JLabel jLabel3 = new JLabel();
  JTextField jTF_In = new JTextField();
  JTextField jTF_Out = new JTextField();
  JButton jButtonSelectPathIn = new JButton();
  JButton jButtonSelectPathOut = new JButton();
  JButton jButtonRun = new JButton();
  JCheckBox jCB_FENKAI = new JCheckBox();
  JCheckBox jCB_HEBING = new JCheckBox();
  JScrollPane jScrollPane1 = new JScrollPane();
  AllCheckFunction acf = null;

  public FrameAllCheck(FrameOur fo) {
    this.fo = fo;
    try {
      jbInit();
    }
    catch (Exception exception) {
      exception.printStackTrace();
    }
  }

  private void jbInit() throws Exception {
    getContentPane().setLayout(borderLayout1);
    jLabel1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
    jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel1.setText("检查所有项目");
    jButtonSelectPathIn.setText("选择");
    jButtonSelectPathIn.addActionListener(new
                                          FrameAllCheck_jButton_actionAdapter(this));
    jButtonSelectPathOut.setText("选择");
    jButtonSelectPathOut.addActionListener(new
                                           FrameAllCheck_jButton_actionAdapter(this));
    this.setDefaultCloseOperation(HIDE_ON_CLOSE);
    jButtonRun.setText("运行");
    jButtonRun.addActionListener(new
                                 FrameAllCheck_jButton_actionAdapter(this));
    jCB_FENKAI.setSelected(true);
    jCB_FENKAI.setText("分文件运行");
    jCB_HEBING.setText("合并所有文件运行");
    jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.getContentPane().add(jLabel1, java.awt.BorderLayout.NORTH);
    this.getContentPane().add(jSplitPane1, java.awt.BorderLayout.CENTER);
    jLabel2.setText("数据文件目录:");
    jPanel1.setLayout(xYLayout1);
    jLabel3.setText("检查结果输出目录:");
    jTF_In.setText("");
    jTF_Out.setText("c:\\");
    jScrollPane1.getViewport().add(item);
    jPanel1.add(jTF_In, new XYConstraints(124, 18, 232, -1));
    jPanel1.add(jLabel2, new XYConstraints(10, 21, -1, -1));
    jPanel1.add(jButtonSelectPathIn, new XYConstraints(367, 17, -1, -1));
    jPanel1.add(jLabel3, new XYConstraints(10, 55, -1, -1));
    jPanel1.add(jTF_Out, new XYConstraints(124, 52, 233, -1));
    jPanel1.add(jButtonSelectPathOut, new XYConstraints(367, 51, -1, -1));
    jPanel1.add(jCB_FENKAI, new XYConstraints(79, 90, -1, -1));
    jPanel1.add(jCB_HEBING, new XYConstraints(172, 90, -1, -1));
    jPanel1.add(jButtonRun, new XYConstraints(333, 90, -1, -1));
    jSplitPane1.add(jPanel1, JSplitPane.TOP);
    jSplitPane1.add(jScrollPane1, JSplitPane.BOTTOM);
    this.initShow();
    jSplitPane1.setDividerLocation(125);
    acf = new AllCheckFunction(this.item,this.fo,this);
  }
  private void initShow(){
    Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
    this.setTitle("批处理文件");
    this.setSize(500, 600);
    this.setLocation(
        (screenDim.width - 500) / 2,
        (screenDim.height - 600) / 2
        );
    this.setIconImage(ItemValue.getImage("HSDIlogo.gif"));
  }
  private void selectPath(JTextField jText){
    JFileChooser fileDialog = new JFileChooser();
    fileDialog.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    if(!(ItemValue.fileChoosePath.equals(""))){
      fileDialog.setCurrentDirectory(new File(ItemValue.fileChoosePath));
    }
    //fileDialog.setSelectedFile(new File(ItemValue.fileName));
    int result = fileDialog.showOpenDialog(this);
    if (result == JFileChooser.APPROVE_OPTION) {
      File f = fileDialog.getSelectedFile();
      ItemValue.fileChoosePath = f.getAbsolutePath();
      this.setPath(f.getAbsolutePath(),jText);
    }
  }
  private void setParam(){
    this.InputPath = this.getRightPath(this.jTF_In.getText());
    this.OutputPath = this.getRightPath(this.jTF_Out.getText());
    this.yunxing_fenkai = this.jCB_FENKAI.isSelected();
    this.yunxing_hebing = this.jCB_HEBING.isSelected();
  }
  /**
   * 把路径的后缀加上//或者\
   */
  private String getRightPath(String path){
    if (! (path.equals(""))) {
      String last = path.substring(path.length() - 1, path.length());
      if (last.equals("\\")) {
        return path;
      }else if(last.equals("/")){
        return path;
      }else{
        return path + "\\";
      }
    }else{
      return "c:\\";
    }
  }
  private void setPath(String path,JTextField jText){
    if (! (path.equals(""))) {
      String directory = "";
      File f = new File(path);
      if (f.isFile()) {
        directory = f.getParent();
      }
      else if (f.isDirectory()) {
        directory = path;
      }
      jText.setText(directory);
    }
  }
  public static void main(String[] args) {
    FrameAllCheck fac = new FrameAllCheck(null);
    fac.show();
  }

  public void jButton_actionPerformed(ActionEvent e) {
    if ( (e.getSource()).equals(this.jButtonSelectPathIn)) {
      this.selectPath(this.jTF_In);
    }
    else if ( (e.getSource()).equals(this.jButtonSelectPathOut)) {
      this.selectPath(this.jTF_Out);
    }
    else if ( (e.getSource()).equals(this.jButtonRun)) {
      this.setParam();
      acf.setPath(this.InputPath,this.OutputPath);
      acf.setYunxing_Type(this.yunxing_fenkai,this.yunxing_hebing);
      acf.check_Start();
      System.out.println("Input:" + this.InputPath);
      System.out.println("Output:" + this.OutputPath);
    }
  }
}

class FrameAllCheck_jButton_actionAdapter
    implements ActionListener {
  private FrameAllCheck adaptee;
  FrameAllCheck_jButton_actionAdapter(FrameAllCheck adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jButton_actionPerformed(e);
  }
}

⌨️ 快捷键说明

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