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

📄 dialogunitetrack.java

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

import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import net.aetherial.gis.surface.ItemValue;
import net.aetherial.gis.our.FrameOur;
/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2004</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class DialogUniteTrack
    extends JDialog {
  FrameOur fo = null;
  JPanel panel1 = new JPanel();
  XYLayout xYLayout1 = new XYLayout();
  JLabel jLabel1 = new JLabel();
  JLabel jLabel2 = new JLabel();
  JComboBox jComboBox1 = new JComboBox();
  JComboBox jComboBox2 = new JComboBox();
  JTextField jTextField1 = new JTextField();
  JButton jButton1 = new JButton();
  JComboBox jComboBox3 = new JComboBox();
  JLabel jLabel3 = new JLabel();
  private int t1=-1,t2=-1;
  public DialogUniteTrack(Frame owner, String title, boolean modal) {
    super(owner, title, modal);
    try {
      setDefaultCloseOperation(DISPOSE_ON_CLOSE);
      jbInit();
      pack();
    }
    catch (Exception exception) {
      exception.printStackTrace();
    }
  }

  public DialogUniteTrack() {
    this(new Frame(), "DialogUniteTrack", false);
  }
  public DialogUniteTrack(FrameOur fo) {
    this();
    this.fo = fo;
  }

  private void jbInit() throws Exception {
    initData();
    this.setTitle("选择并合并");
    Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
    this.setSize(new Dimension(390,360));
    this.addWindowFocusListener(new Dialog_this_windowFocusAdapter(this));
    this.setLocation(
          (screenDim.width - 390) / 2,
          (screenDim.height - 360) / 2
          );

    panel1.setLayout(xYLayout1);
    jLabel1.setText("选择航迹:");
    jLabel2.setText("选择航迹:");
    jTextField1.setText("");
    jButton1.setText("  O K  ");
    jButton1.addActionListener(new DialogUniteTrack_jButton1_actionAdapter(this));
    jLabel3.setText("生成航迹:");
    jComboBox1.addItemListener(new DialogUniteTrack_jComboBox_itemAdapter(this));
    jComboBox2.addItemListener(new DialogUniteTrack_jComboBox_itemAdapter(this));
    getContentPane().add(panel1);
    panel1.add(jLabel1, new XYConstraints(19, 23, 81, 26));
    panel1.add(jLabel2, new XYConstraints(19, 53, 92, 32));
    panel1.add(jLabel3, new XYConstraints(19, 92, 93, 25));
    panel1.add(jComboBox1, new XYConstraints(139, 22, 132, -1));
    panel1.add(jComboBox2, new XYConstraints(139, 63, 132, -1));
    panel1.add(jTextField1, new XYConstraints(139, 104, 132, -1));
    panel1.add(jButton1, new XYConstraints(87, 148, -1, -1));
  }
  public void initData(){
   int[] pos1 = ItemValue.getPosition("track");
   if(pos1!=null){
     for (int i = 0;i<pos1.length;i++){
       jComboBox1.addItem(ItemValue.getTracksName(ItemValue.getTracksByPos(i)));
       jComboBox2.addItem(ItemValue.getTracksName(ItemValue.getTracksByPos(i)));
     }
   }
 }

  public void jComboBox_itemStateChanged(ItemEvent e) {
    if((JComboBox)e.getSource()==jComboBox1){
      t1= jComboBox1.getSelectedIndex();
      System.out.println("jComboBox1|Select:"+jComboBox1.getSelectedIndex()+"|"+jComboBox1.getSelectedItem());
    }else if((JComboBox)e.getSource()==jComboBox2){
      t2= jComboBox1.getSelectedIndex();
      System.out.println("jComboBox2|Select:"+jComboBox1.getSelectedIndex()+"|"+jComboBox1.getSelectedItem());
    }
    this.setTrackName();
  }
  private void setTrackName(){
    if((t1!=-1)&&(t2!=-1)){
      this.jTextField1.setText(ItemValue.getTracksName(t1)+" And "+ItemValue.getTracksName(t2));
    }
  }
  public void jButton1_actionPerformed(ActionEvent e) {
    if((t1!=-1)&&(t2!=-1)){
      UniteSection us = new UniteSection();
      us.setTrack(t1, t2);
      us.setTracksName(this.jTextField1.getText());
      us.insertIntoGarminDoc();
      fo.memoryShow(true,false);
    }
    this.hide();

  }
}

class DialogUniteTrack_jButton1_actionAdapter
    implements ActionListener {
  private DialogUniteTrack adaptee;
  DialogUniteTrack_jButton1_actionAdapter(DialogUniteTrack adaptee) {
    this.adaptee = adaptee;
  }

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

class DialogUniteTrack_jComboBox_itemAdapter
    implements ItemListener {
  private DialogUniteTrack adaptee;
  DialogUniteTrack_jComboBox_itemAdapter(DialogUniteTrack adaptee) {
    this.adaptee = adaptee;
  }

  public void itemStateChanged(ItemEvent e) {
    adaptee.jComboBox_itemStateChanged(e);
  }
}

⌨️ 快捷键说明

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