frametojtb.java

来自「基于Java的地图数据管理软件。使用MySQL数据库管理系统。」· Java 代码 · 共 127 行

JAVA
127
字号
package net.aetherial.gis.jiaotongbu.output.show;

import java.awt.*;
import javax.swing.*;
import net.aetherial.gis.our.allauto.frame.PathSelect;
import net.aetherial.gis.our.FrameOur;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import net.aetherial.gis.jiaotongbu.output.type.ScanAll;
import net.aetherial.gis.surface.ItemValue;
import net.aetherial.gis.jiaotongbu.output.type.ToNewXiangzhen;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2004</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class FrameToJTB
    extends JFrame {
  BorderLayout borderLayout1 = new BorderLayout();
  PathSelect pathSelect = new PathSelect();
  JPanel jPanel2 = new JPanel();
  JButton jButton = new JButton();
  private FrameOur fo = null;
  JPanel jPanel1 = new JPanel();
  SelectXian jPanel3 = new SelectXian();
  JButton jButtonToNewXIangzhen = new JButton();

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

  public void show() {
    Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
    this.setTitle("生成交通部填报表格");
    this.setSize(460, 380);
    this.setLocation(
        (screenDim.width - 460) / 2,
        (screenDim.height - 380) / 2
        );
    super.show();
  }

  private void jbInit() throws Exception {
    getContentPane().setLayout(borderLayout1);
    jButton.setText("运行");
    jButton.addActionListener(new FrameToJTB_jButton_actionAdapter(this));
    pathSelect.setHideArraySelect();
    jButtonToNewXIangzhen.setText("生成新的乡镇");
    jButtonToNewXIangzhen.addActionListener(new
                                            FrameToJTB_jButtonToNewXIangzhen_actionAdapter(this));
    this.getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);
    jPanel2.add(jButton);
    jPanel2.add(jButtonToNewXIangzhen);
    this.getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
    jPanel1.add(jPanel3);
    jPanel1.add(pathSelect);
  }

  public void jButton_actionPerformed(ActionEvent e) {
    jPanel3.setXian();
    ScanAll sa = new ScanAll(this.fo);
    ItemValue.setArrayPath(getSplashPath(pathSelect.getArrayPath()));
    sa.setInputAllDirectory(pathSelect.getInputPath());
    sa.setOutputDirectory(pathSelect.getOutputPath());
    sa.scanAllFile();
    System.out.println("width:" + this.getWidth() + ",height:" + this.getHeight());
  }

  private String getSplashPath(String path) {
    if (path.endsWith("\\")) {
      return path;
    }
    else if (path.endsWith("/")) {
      return path;
    }
    else {
      return path + "\\";
    }
  }

  public void jButtonToNewXIangzhen_actionPerformed(ActionEvent e) {
    jPanel3.setXian();
    ItemValue.setArrayPath(getSplashPath(pathSelect.getArrayPath()));
    ToNewXiangzhen tx = new ToNewXiangzhen();
    System.out.println(tx.getN());
    tx.toFile(pathSelect.getOutputPath());
  }
}

class FrameToJTB_jButtonToNewXIangzhen_actionAdapter
    implements ActionListener {
  private FrameToJTB adaptee;
  FrameToJTB_jButtonToNewXIangzhen_actionAdapter(FrameToJTB adaptee) {
    this.adaptee = adaptee;
  }

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

class FrameToJTB_jButton_actionAdapter
    implements ActionListener {
  private FrameToJTB adaptee;
  FrameToJTB_jButton_actionAdapter(FrameToJTB adaptee) {
    this.adaptee = adaptee;
  }

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

⌨️ 快捷键说明

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