?? person_info.java
字號:
package scince;
import java.awt.*;
import java.sql.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import com.borland.dx.dataset.TableDataSet;
import com.borland.dbswing.JdbTable;
import java.io.*;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import java.awt.Dimension;
import java.awt.Font;
import javax.swing.JOptionPane;
public class person_Info extends JFrame {
public person_Info() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
getContentPane().setLayout(null);
jLabel1.setForeground(Color.cyan);
jLabel1.setText("編碼*");
jLabel1.setBounds(new Rectangle(17, 16, 69, 27));
getContentPane().setSize(500, 580);
jButton1.addActionListener(new person_Info_jButton1_actionAdapter(this));
jButton1.setBounds(new Rectangle(54, 410, 91, 37));
jButton1.setForeground(Color.cyan);
jButton1.setText("查看");
jLabel12.setForeground(Color.cyan);
jLabel12.setText("津貼工資(元)");
jLabel12.setBounds(new Rectangle(277, 268, 85, 31));
jLabel11.setForeground(Color.cyan);
jLabel11.setText("崗位工資");
jLabel11.setBounds(new Rectangle(301, 221, 57, 29));
jLabel10.setForeground(Color.cyan);
jLabel10.setText("基本工資");
jLabel10.setBounds(new Rectangle(299, 156, 67, 45));
jLabel9.setForeground(Color.cyan);
jLabel9.setText("職稱");
jLabel9.setBounds(new Rectangle(301, 111, 62, 31));
jLabel8.setForeground(Color.cyan);
jLabel8.setText("參加工作時間");
jLabel8.setBounds(new Rectangle(300, 50, 73, 43));
jLabel7.setForeground(Color.cyan);
jLabel7.setText("所在部門");
jLabel7.setBounds(new Rectangle(303, 9, 72, 35));
jLabel6.setForeground(Color.cyan);
jLabel6.setText("文化程度");
jLabel6.setBounds(new Rectangle(15, 270, 53, 30));
jLabel5.setForeground(Color.cyan);
jLabel5.setText("民族");
jLabel5.setBounds(new Rectangle(16, 219, 45, 41));
jLabel4.setForeground(Color.cyan);
jLabel4.setText("出生年月日");
jLabel4.setBounds(new Rectangle(15, 150, 65, 49));
jLabel3.setForeground(Color.cyan);
jLabel3.setText("性別");
jLabel3.setBounds(new Rectangle(14, 109, 51, 29));
jLabel2.setForeground(Color.cyan);
jLabel2.setText("姓名");
jLabel2.setBounds(new Rectangle(14, 57, 55, 32));
jButton2.setBounds(new Rectangle(171, 409, 80, 40));
jButton2.setForeground(Color.cyan);
jButton2.setText("刪除");
jButton2.addActionListener(new person_Info_jButton2_actionAdapter(this));
jButton3.setBounds(new Rectangle(291, 411, 88, 37));
jButton3.setForeground(Color.cyan);
jButton3.setText("添加");
jButton3.addActionListener(new person_Info_jButton3_actionAdapter(this));
jButton4.setBounds(new Rectangle(412, 409, 91, 39));
jButton4.setForeground(Color.cyan);
jButton4.setText("退出");
jButton4.addActionListener(new person_Info_jButton4_actionAdapter(this));
jLabel13.setBackground(Color.white);
jLabel13.setForeground(Color.cyan);
jLabel13.setText("請輸入編碼來查找或刪除");
jLabel13.setBounds(new Rectangle(81, 314, 212, 43));
jTextField13.setForeground(Color.cyan);
jTextField13.setBounds(new Rectangle(97, 346, 118, 45));
jButton5.setBounds(new Rectangle(325, 341, 140, 51));
jButton5.setForeground(Color.cyan);
jButton5.setText("清除所有信息");
jButton5.addActionListener(new person_Info_jButton5_actionAdapter(this));
jTextField7.setForeground(Color.cyan);
jTextField7.setBounds(new Rectangle(385, 12, 91, 28));
jTextField1.setForeground(Color.cyan);
jTextField1.setBounds(new Rectangle(91, 19, 86, 28));
jTextField2.setForeground(Color.cyan);
jTextField2.setBounds(new Rectangle(90, 63, 89, 28));
jTextField8.setForeground(Color.cyan);
jTextField8.setBounds(new Rectangle(385, 58, 95, 33));
jTextField3.setForeground(Color.cyan);
jTextField3.setBounds(new Rectangle(90, 111, 89, 30));
jTextField9.setForeground(Color.cyan);
jTextField9.setBounds(new Rectangle(383, 104, 96, 31));
jTextField4.setForeground(Color.cyan);
jTextField4.setBounds(new Rectangle(90, 164, 89, 31));
jTextField10.setForeground(Color.cyan);
jTextField10.setBounds(new Rectangle(383, 158, 95, 34));
jTextField5.setForeground(Color.cyan);
jTextField5.setBounds(new Rectangle(90, 224, 89, 31));
jTextField11.setForeground(Color.cyan);
jTextField11.setBounds(new Rectangle(384, 215, 97, 30));
jTextField6.setForeground(Color.cyan);
jTextField6.setBounds(new Rectangle(91, 270, 88, 30));
jTextField12.setForeground(Color.cyan);
jTextField12.setBounds(new Rectangle(383, 261, 95, 32));
this.getContentPane().setBackground(new java.awt.Color(132, 110, 168));
this.getContentPane().add(jLabel7, null);
this.getContentPane().add(jTextField1, null);
this.getContentPane().add(jTextField2, null);
this.getContentPane().add(jTextField3, null);
this.getContentPane().add(jTextField4, null);
this.getContentPane().add(jTextField5, null);
this.getContentPane().add(jTextField6, null);
this.getContentPane().add(jTextField7, null);
this.getContentPane().add(jLabel3, null);
this.getContentPane().add(jLabel2, null);
this.getContentPane().add(jLabel4, null);
this.getContentPane().add(jLabel5, null);
this.getContentPane().add(jLabel6, null);
this.getContentPane().add(jTextField8, null);
this.getContentPane().add(jLabel8, null);
this.getContentPane().add(jLabel9, null);
this.getContentPane().add(jLabel10, null);
this.getContentPane().add(jLabel11, null);
this.getContentPane().add(jLabel12, null);
this.getContentPane().add(jLabel13);
this.getContentPane().add(jTextField13);
this.getContentPane().add(jButton1, null);
this.getContentPane().add(jButton2);
this.getContentPane().add(jButton3);
this.getContentPane().add(jButton4);
this.getContentPane().add(jButton5);
this.getContentPane().add(jTextField10, null);
this.getContentPane().add(jTextField9, null);
this.getContentPane().add(jTextField11, null);
this.getContentPane().add(jTextField12, null);
this.getContentPane().add(jLabel1, null);
}
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
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();
JLabel jLabel10 = new JLabel();
JLabel jLabel11 = new JLabel();
JLabel jLabel12 = new JLabel();
JTextField jTextField1 = new JTextField();
JTextField jTextField2 = new JTextField();
JTextField jTextField3 = new JTextField();
JTextField jTextField4 = new JTextField();
JTextField jTextField5 = new JTextField();
JTextField jTextField6 = new JTextField();
JTextField jTextField7 = new JTextField();
JTextField jTextField8 = new JTextField();
JTextField jTextField9 = new JTextField();
JTextField jTextField10 = new JTextField();
JTextField jTextField11 = new JTextField();
JTextField jTextField12 = new JTextField();
JButton jButton1 = new JButton();
private String sqlString;
private Connection con;
private Statement query;
private ResultSet rs;
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
JButton jButton4 = new JButton();
JLabel jLabel13 = new JLabel();
JTextField jTextField13 = new JTextField();
JButton jButton5 = new JButton();
public void jButton1_actionPerformed(ActionEvent e) {
Connection con;
Statement sql;
ResultSet rs;
String queryString;
if (!jTextField13.getText().equals("")) {
queryString = "select * from 人員信息 where 編號=" +
Integer.parseInt(jTextField13.getText());
} else {
queryString = "";
JOptionPane.showMessageDialog(null, "請輸入您要查看的人員編號!", "人員信息查詢對話框",
JOptionPane.INFORMATION_MESSAGE);
}
try {
con = DriverManager.getConnection("jdbc:odbc:scince", "", "");
sql = con.createStatement();
rs = sql.executeQuery(queryString);
if (rs.next()) {
jTextField1.setText(Integer.toString(rs.getInt(1)));
jTextField2.setText(rs.getString(2));
jTextField3.setText(rs.getString(3));
jTextField4.setText(rs.getString(4));
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -