📄 dukouframe.java
字号:
package net.aetherial.gis.surface.design.jiaotongbu;
import java.awt.event.ActionEvent;
import java.awt.Toolkit;
import com.borland.jbcl.layout.XYLayout;
import java.awt.Font;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import java.awt.Dimension;
import javax.swing.WindowConstants;
import net.aetherial.gis.surface.design.NumberTextField;
import javax.swing.JTextField;
import net.aetherial.gis.surface.ItemValue;
import javax.swing.SwingConstants;
import net.aetherial.gis.surface.FrameMain;
import javax.swing.JLabel;
import com.borland.jbcl.layout.XYConstraints;
import javax.swing.JFrame;
import javax.swing.JCheckBox;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;
import javax.swing.JTextArea;
import javax.swing.*;
import java.awt.*;
import javax.swing.border.TitledBorder;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class DukouFrame
extends JFrame {
XYLayout xYLayout1 = new XYLayout();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JTextField jTF_name = new JTextField();
JButton jB_Submit = new JButton();
JButton jB_Cancel = new JButton();
private FrameMain fm = null;
JCheckBox jC_rendu = new JCheckBox();
JCheckBox jC_qidu = new JCheckBox();
ButtonGroup group = new ButtonGroup();
JTextField jTF_Number = new JTextField();
NumberTextField jTF_Shijian = new NumberTextField();
NumberTextField jTF_Zhuanghao = new NumberTextField();
NumberTextField jTF_Kudandu = new NumberTextField();
JCheckBox jC_Jidong = new JCheckBox();
JTextArea jTA_Beizhu = new JTextArea();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JLabel jLabel6 = new JLabel();
JLabel jLabel7 = new JLabel();
JLabel jLabel8 = new JLabel();
JLabel jLabel9 = new JLabel();
TitledBorder titledBorder1 = new TitledBorder("");
public DukouFrame(FrameMain fm) {
this.fm = fm;
try {
jbInit();
}
catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
getContentPane().setLayout(xYLayout1);
jLabel1.setFont(new java.awt.Font("Dialog", Font.BOLD, 14));
jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
jLabel1.setText("设置渡口属性");
jB_Submit.setText("确定");
jB_Submit.addActionListener(new DukouFrame_jB_actionAdapter(this));
jB_Cancel.setText("取消");
jB_Cancel.addActionListener(new DukouFrame_jB_actionAdapter(this));
jC_rendu.setText("人渡");
jC_qidu.setText("汽渡");
xYLayout1.setWidth(448);
xYLayout1.setHeight(469);
jC_Jidong.setText("是");
jLabel3.setText("渡口编号:");
jLabel4.setText("建成时间(年份):");
jLabel5.setText("起点桩号:");
jLabel6.setText("渡口宽度(米):");
jLabel7.setText("是否机动渡口:");
jLabel8.setText("渡口类型:");
jLabel9.setText(" 备注:");
jTA_Beizhu.setBorder(null);
this.getContentPane().add(jLabel1, new XYConstraints(144, 21, 116, 35));
jLabel2.setText("渡口名称:");
group.add(this.jC_rendu);
group.add(this.jC_qidu);
this.getContentPane().add(jLabel2, new XYConstraints(93, 76, -1, -1));
this.getContentPane().add(jLabel8, new XYConstraints(93, 305, -1, -1));
this.getContentPane().add(jLabel7, new XYConstraints(93, 267, -1, -1));
this.getContentPane().add(jLabel6, new XYConstraints(93, 229, -1, -1));
this.getContentPane().add(jLabel5, new XYConstraints(93, 190, -1, -1));
this.getContentPane().add(jLabel4, new XYConstraints(93, 152, -1, -1));
this.getContentPane().add(jLabel3, new XYConstraints(93, 114, -1, -1));
this.getContentPane().add(jLabel9, new XYConstraints(93, 343, -1, -1));
this.getContentPane().add(jTF_name, new XYConstraints(214, 73, 126, -1));
this.getContentPane().add(jB_Submit, new XYConstraints(139, 413, -1, -1));
this.getContentPane().add(jB_Cancel, new XYConstraints(238, 413, -1, -1));
this.getContentPane().add(jTA_Beizhu, new XYConstraints(214, 347, 126, 48));
this.getContentPane().add(jC_qidu, new XYConstraints(279, 300, -1, -1));
this.getContentPane().add(jC_rendu, new XYConstraints(214, 301, -1, 22));
this.getContentPane().add(jC_Jidong, new XYConstraints(214, 263, 126, 22));
this.getContentPane().add(jTF_Kudandu, new XYConstraints(214, 225, 126, 22));
this.getContentPane().add(jTF_Zhuanghao,
new XYConstraints(214, 187, 126, 22));
this.getContentPane().add(jTF_Shijian, new XYConstraints(214, 149, 126, 22));
this.getContentPane().add(jTF_Number, new XYConstraints(214, 111, 126, 22));
this.init();
this.initValue();
}
private void init() {
this.setTitle("设置渡口属性");
this.setSize(435, 490);
this.setIconImage(ItemValue.getImage("HSDIlogo.gif"));
Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation(
(screenDim.width - 435) / 2,
(screenDim.height - 490) / 2
);
this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
}
public void initValue() {
this.jTF_name.setText(this.fm.getWaypointName());
String[] value = this.fm.getJTB_Dukou();
if (value != null && value.length >= 8) {
this.jTF_Number.setText(value[1]);
this.jTF_Shijian.setText(value[2]);
this.jTF_Zhuanghao.setText(value[3]);
this.jTF_Kudandu.setText(value[4]);
if (value[5].equals("是")) {
this.jC_Jidong.setSelected(true);
}
if (value[6].equals("人渡")) {
this.jC_rendu.setSelected(true);
}
else if (value[6].equals("汽渡")) {
this.jC_qidu.setSelected(true);
}
this.jTA_Beizhu.setText(value[7]);
// null.setText(value[1]);
}
else {
this.jC_rendu.setSelected(false);
this.jC_qidu.setSelected(false);
this.jTF_Number.setText("");
this.jTF_Shijian.setText("");
this.jTF_Zhuanghao.setText("");
this.jTF_Kudandu.setText("");
this.jC_Jidong.setSelected(false);
this.jTA_Beizhu.setText("");
}
}
public void jB_actionPerformed(ActionEvent e) {
if (e.getSource().equals(this.jB_Submit)) {
String[] array = new String[8];
array[0] = this.jTF_name.getText().trim();
array[1] = this.jTF_Number.getText().trim();
array[2] = this.jTF_Shijian.getText().trim();
array[3] = this.jTF_Zhuanghao.getText().trim();
array[4] = this.jTF_Kudandu.getText().trim();
if (this.jC_Jidong.isSelected()) {
array[5] = "是";
}
else {
array[5] = "否";
}
if (this.jC_qidu.isSelected()) {
array[6] = "汽渡";
}
if (this.jC_rendu.isSelected()) {
array[6] = "人渡";
}
array[7] = this.jTA_Beizhu.getText().trim();
// array[1] = null.getText();
this.fm.setWaypointName(array[0]);
this.fm.setJTB_Dukou(array);
}
this.hide();
// System.out.println("height:" + this.getHeight() + ",width:" + this.getWidth());
}
}
class DukouFrame_jB_actionAdapter
implements ActionListener {
private DukouFrame adaptee;
DukouFrame_jB_actionAdapter(DukouFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jB_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -