📄 d_create1.java~695~
字号:
package edu.whu.gui;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;
import edu.whu.database.ConnectionPooling;
import java.sql.*;
import edu.whu.poly.*;
import javax.swing.table.*;
import java.util.Vector;
import java.util.Enumeration;
import java.util.StringTokenizer;
import com.sunking.swing.JDateField;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class D_Create1
extends JDialog
{
String tablename=null;
polyStruct Tdata = null;
JCheckBox b = new JCheckBox("");
TitledBorder titledBorder1;
TitledBorder titledBorder2;
TitledBorder titledBorder3;
TitledBorder titledBorder4;
ImageIcon image1;
ImageIcon image2;
int modify1 = 0;
Vector posData = null;
D_DataInputTable DataInputTable_D1 = null;
String[] columnNames =
{
"", "工程名", "工程开始时间", "工程责任人", "工程坐标系统"
};
Object[][] data = new Object[0][5];
DefaultTableModel dm = new DefaultTableModel(data, columnNames)
{
public Class getColumnClass(int column)
{
return getValueAt(0, column).getClass();
}
};
JTable jTable1 = new JTable(dm);
int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane panel1 = new JScrollPane(jTable1, v, h);
JPanel jPanel1 = new JPanel();
JTextField name = new JTextField();
JLabel jLabel6 = new JLabel();
JLabel date1 = new JLabel();
JDateField date = new JDateField();
JLabel coordinate1 = new JLabel();
JTextField coordinate = new JTextField();
JLabel jLabel9 = new JLabel();
JTextField man = new JTextField();
JLabel jLabel10 = new JLabel();
JTextField position1 = new JTextField();
JLabel jLabel11 = new JLabel();
JLabel jLabel12 = new JLabel();
JLabel jLabel13 = new JLabel();
JTextField eposition = new JTextField();
JTextField position2 = new JTextField();
JTextField position3 = new JTextField();
JButton add = new JButton();
JButton reset = new JButton();
JPanel jPanel2 = new JPanel();
JLabel jLabel1 = new JLabel();
JButton down = new JButton();
JPanel jPanel3 = new JPanel();
TitledBorder titledBorder5;
JButton jButton2 = new JButton();
JButton del = new JButton();
JButton modify = new JButton();
JTextField posnumber = new JTextField();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel7 = new JLabel();
JTextField number = new JTextField();
public D_Create1(Frame frame, String title, boolean modal,String table)
{
super(frame, title, modal);
try
{
jbInit(table);
pack();
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
public D_Create1(JDialog frame, String title, boolean modal,String table)
{
super(frame, title, modal);
try
{
jbInit(table);
pack();
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
public void createTableModel()
{
}
public void addTableDate(String[] data)
{
}
public void D_Create1addTableDate(Object[] data)
{
dm.addRow(data);
}
public void D_Create1ReadData(String tablename)
{
boolean flag = false;
String sqlcmd = "";
String ItemData1 = null;
String ItemData2 = null;
String fromDate = null;
String toDate = null;
String coordinate;
try
{
polyProcess p1 = new polyProcess();
polyRecord record = new polyRecord("./");
polyStruct[] Pdata = record.polyRecord_ReadProper(sqlcmd, tablename);
if (Pdata.length > 0)
{
for (int j = 0; j < Pdata.length; j++)
{
if (Pdata[j].getPropertyArray() != null)
{
D_Create1addTableDate(Pdata[j].getAbstractPropertyArray());
}
}
}
}
catch (Exception e1)
{
e1.printStackTrace();
}
}
public void change()
{
//JCheckBox.setBorder(null);
DefaultCellEditor editor = new DefaultCellEditor(b);
jTable1.getColumn("").setResizable(false);
jTable1.getColumn("").setCellEditor(editor);
jTable1.getColumn("").setCellRenderer(new DefaultTableCellRenderer()
{
public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus,
int row, int col)
{
if (value.toString().equalsIgnoreCase("true"))
{
b.setSelected(true);
return b;
}
else if (value.toString().equalsIgnoreCase("false"))
{
b.setSelected(false);
return b;
}
return b;
}
public void setValue(Object value)
{
String password = "";
int wordLong = value.toString().length();
for (int i = 0; i < wordLong; i++)
password += "*";
super.setValue(password);
}
});
}
private void jbInit(String table) throws Exception
{
tablename=table;
b.setBorder(null);
image1 = new ImageIcon(edu.whu.gui.D_Create1.class.getResource(
"icons/downflag.jpg"));
image2 = new ImageIcon(edu.whu.gui.D_Create1.class.getResource(
"icons/return.jpg"));
titledBorder1 = new TitledBorder("");
titledBorder2 = new TitledBorder("");
titledBorder3 = new TitledBorder("");
titledBorder4 = new TitledBorder("");
titledBorder5 = new TitledBorder("");
this.getContentPane().setLayout(null);
panel1.setHorizontalScrollBarPolicy(JScrollPane.
HORIZONTAL_SCROLLBAR_AS_NEEDED);
panel1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
panel1.setFont(new java.awt.Font("Dialog", 0, 12));
panel1.setAutoscrolls(true);
panel1.setBorder(BorderFactory.createEtchedBorder());
panel1.setPreferredSize(new Dimension(454, 441));
panel1.setRequestFocusEnabled(true);
panel1.setToolTipText("");
panel1.setBounds(new Rectangle(502, 23, 268, 302));
this.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
this.setJMenuBar(null);
this.setModal(false);
this.setTitle("创建工程信息");
TableColumn column = jTable1.getColumnModel().getColumn(0);
TableColumn column1 = jTable1.getColumnModel().getColumn(1);
TableColumn column2 = jTable1.getColumnModel().getColumn(2);
TableColumn column3 = jTable1.getColumnModel().getColumn(3);
TableColumn column4 = jTable1.getColumnModel().getColumn(4);
column.setPreferredWidth(10);
column1.setPreferredWidth(200);
column2.setPreferredWidth(130);
column3.setPreferredWidth(130);
column4.setPreferredWidth(130);
jTable1.setEnabled(true);
jTable1.setDoubleBuffered(false);
jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
jTable1.setRowSelectionAllowed(false);
jPanel1.setBorder(BorderFactory.createEtchedBorder());
jPanel1.setBounds(new Rectangle(490, 8, 294, 383));
jPanel1.setLayout(null);
name.setText("");
name.setBounds(new Rectangle(143, 55, 319, 22));
jLabel6.setBounds(new Rectangle(5, 48, 55, 36));
jLabel6.setText("工程名:");
jLabel6.setFont(new java.awt.Font("Dialog", 1, 12));
jLabel6.setForeground(Color.black);
date1.setForeground(Color.black);
date1.setFont(new java.awt.Font("Dialog", 1, 12));
date1.setText("工程开始时间:");
date1.setBounds(new Rectangle(5, 79, 102, 36));
date.setBounds(new Rectangle(143, 86, 73, 22));
coordinate1.setBounds(new Rectangle(5, 111, 102, 36));
coordinate1.setText("工程坐标系统:");
coordinate1.setFont(new java.awt.Font("Dialog", 1, 12));
coordinate1.setForeground(Color.black);
coordinate.setText("");
coordinate.setBounds(new Rectangle(143, 118, 256, 22));
jLabel9.setForeground(Color.black);
jLabel9.setFont(new java.awt.Font("Dialog", 1, 12));
jLabel9.setText("工程责任人:");
jLabel9.setBounds(new Rectangle(5, 143, 102, 36));
man.setBounds(new Rectangle(143, 150, 256, 22));
man.setText("");
jLabel10.setBounds(new Rectangle(5, 173, 127, 36));
jLabel10.setText("工程说明书位置1:");
jLabel10.setFont(new java.awt.Font("Dialog", 1, 12));
jLabel10.setForeground(Color.black);
position1.setBounds(new Rectangle(143, 180, 322, 22));
position1.setText("");
jLabel11.setForeground(Color.black);
jLabel11.setFont(new java.awt.Font("Dialog", 1, 12));
jLabel11.setText("工程说明书位置2:");
jLabel11.setBounds(new Rectangle(5, 204, 135, 36));
jLabel12.setBounds(new Rectangle(5, 235, 135, 36));
jLabel12.setText("工程说明书位置3:");
jLabel12.setFont(new java.awt.Font("Dialog", 1, 12));
jLabel12.setForeground(Color.black);
jLabel12.setToolTipText("");
jLabel13.setToolTipText("");
jLabel13.setForeground(Color.black);
jLabel13.setFont(new java.awt.Font("Dialog", 1, 12));
jLabel13.setText("工程电子文件保存位置:");
jLabel13.setBounds(new Rectangle(4, 265, 155, 36));
eposition.setBounds(new Rectangle(143, 272, 295, 22));
eposition.setText("");
position2.setText("");
position2.setBounds(new Rectangle(143, 211, 322, 22));
position3.setText("");
position3.setBounds(new Rectangle(143, 242, 322, 22));
add.setBounds(new Rectangle(23, 14, 79, 25));
add.setSelectedIcon(null);
add.setText("添加");
add.addActionListener(new D_Create1_add_actionAdapter(this));
reset.setText("重置");
reset.addActionListener(new D_Create1_reset_actionAdapter(this));
reset.setSelectedIcon(null);
reset.setBounds(new Rectangle(373, 14, 79, 26));
jPanel2.setEnabled(true);
jPanel2.setBorder(BorderFactory.createEtchedBorder());
jPanel2.setBounds(new Rectangle(3, 9, 477, 382));
jPanel2.setLayout(null);
jLabel1.setFont(new java.awt.Font("Dialog", 1, 12));
jLabel1.setText("工程坐标点数:");
jLabel1.setBounds(new Rectangle(5, 297, 123, 29));
down.setBounds(new Rectangle(195, 299, 28, 25));
down.setIcon(image1);
down.addActionListener(new D_Create1_down_actionAdapter(this));
jPanel3.setBorder(BorderFactory.createEtchedBorder());
jPanel3.setBounds(new Rectangle(5, 327, 466, 49));
jPanel3.setLayout(null);
jButton2.setBounds(new Rectangle(369, 415, 73, 25));
jButton2.setIcon(image2);
jButton2.addActionListener(new D_Create1_jButton2_actionAdapter(this));
D_Create1ReadData(tablename);
//change();
del.setBounds(new Rectangle(39, 343, 66, 26));
del.setText("删除");
del.addActionListener(new D_Create1_del_actionAdapter(this));
modify.setText("修改");
modify.addActionListener(new D_Create1_modify_actionAdapter(this));
modify.setBounds(new Rectangle(183, 342, 67, 26));
posnumber.setText("");
posnumber.setHorizontalAlignment(SwingConstants.LEADING);
posnumber.setBounds(new Rectangle(143, 300, 44, 22));
jLabel2.setText("jLabel2");
jLabel2.setBounds(new Rectangle(8, 52, 102, 36));
jLabel3.setText("jLabel3");
jLabel3.setBounds(new Rectangle(8, 18, 55, 36));
jLabel7.setForeground(Color.black);
jLabel7.setFont(new java.awt.Font("Dialog", 1, 12));
jLabel7.setText("工程编号:");
jLabel7.setBounds(new Rectangle(8, 18, 74, 36));
number.setBounds(new Rectangle(143, 25, 135, 22));
number.setText("");
this.getContentPane().add(panel1);
this.getContentPane().add(jPanel1, null);
jPanel1.add(del, null);
jPanel1.add(modify, null);
this.getContentPane().add(jPanel2, null);
jPanel2.add(jPanel3, null);
jPanel3.add(add, null);
jPanel3.add(reset, null);
jPanel2.add(jLabel11, null);
jPanel2.add(jLabel6, null);
jPanel2.add(date1, null);
jPanel2.add(coordinate1, null);
jPanel2.add(jLabel9, null);
jPanel2.add(jLabel10, null);
jPanel2.add(jLabel12, null);
jPanel2.add(posnumber, null);
jPanel2.add(down, null);
jPanel2.add(jLabel7, null);
jPanel2.add(jLabel1, null);
jPanel2.add(eposition, null);
jPanel2.add(jLabel13, null);
jPanel2.add(position3, null);
jPanel2.add(position2, null);
jPanel2.add(position1, null);
jPanel2.add(man, null);
jPanel2.add(coordinate, null);
jPanel2.add(date, null);
jPanel2.add(name, null);
jPanel2.add(number, null);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -