package test;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import com.borland.jbcl.layout.*;
import java.sql.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2010</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class Add extends JFrame {
TextField textField1 = new TextField();
TextField textField2 = new TextField();
TextField textField3 = new TextField();
TextField textField4 = new TextField();
TextField textField5 = new TextField();
TextField textField6 = new TextField();
TextField textField7 = new TextField();
TextField textField8 = new TextField();
XYLayout xYLayout1 = new XYLayout();
TextField textField9 = new TextField();
Button button2 = new Button();
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();
public Add() {
setBak();
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
this.getContentPane().setLayout(xYLayout1);
textField1.setBackground(SystemColor.inactiveCaption);
textField1.setColumns(10);
textField1.setText("");
textField2.setBackground(SystemColor.inactiveCaption);
textField2.setColumns(10);
textField2.setText("");
textField2.addActionListener(new Add_textField2_actionAdapter(this));
textField3.setBackground(SystemColor.inactiveCaption);
textField3.setColumns(10);
textField3.setText("");
textField4.setBackground(SystemColor.inactiveCaption);
textField4.setColumns(27);
textField4.setText("");
textField5.setBackground(SystemColor.inactiveCaption);
textField5.setColumns(24);
textField5.setText("");
textField6.setBackground(SystemColor.inactiveCaption);
textField6.setColumns(10);
textField6.setText("");
textField7.setBackground(SystemColor.inactiveCaption);
textField7.setColumns(10);
textField7.setText("");
textField8.setBackground(SystemColor.inactiveCaption);
textField8.setColumns(27);
textField8.setText("");
textField9.setBackground(SystemColor.inactiveCaption);
textField9.setSelectionStart(10);
button2.setBackground(SystemColor.activeCaptionBorder);
button2.setFont(new java.awt.Font("Dialog", 0, 20));
button2.setLabel("录入");
button2.addActionListener(new Add_button2_actionAdapter(this));
xYLayout1.setWidth(533);
xYLayout1.setHeight(392);
jLabel1.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel1.setText("编号:");
jLabel2.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel2.setText("姓名:");
jLabel3.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel3.setText("部门:");
jLabel4.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel4.setText("性别:");
jLabel5.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel5.setText("职位:");
jLabel6.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel6.setText("工资:");
jLabel7.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel7.setText("电话:");
jLabel8.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel8.setText("家庭住址:");
jLabel9.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel9.setText("备注:");
this.getContentPane().add(textField2, new XYConstraints(364, 13, 106, -1));
this.getContentPane().add(textField3, new XYConstraints(364, 55, 108, -1));
this.getContentPane().add(textField9, new XYConstraints(125, 52, 113, 24));
this.getContentPane().add(textField6, new XYConstraints(123, 91, 114, -1));
this.getContentPane().add(textField1, new XYConstraints(126, 15, 112, 25));
this.getContentPane().add(textField7, new XYConstraints(365, 89, 106, -1));
this.getContentPane().add(textField4, new XYConstraints(121, 127, 350, -1));
this.getContentPane().add(textField8, new XYConstraints(118, 208, 351, -1));
this.getContentPane().add(textField5, new XYConstraints(120, 166, 350, -1));
this.getContentPane().add(jLabel1, new XYConstraints(32, 6, 62, 40));
this.getContentPane().add(jLabel2, new XYConstraints(279, 8, 70, 39));
this.getContentPane().add(jLabel4, new XYConstraints(30, 47, 74, 37));
this.getContentPane().add(jLabel5, new XYConstraints(30, 85, 77, 36));
this.getContentPane().add(jLabel3, new XYConstraints(278, 46, 76, 37));
this.getContentPane().add(jLabel6, new XYConstraints(277, 84, 75, 33));
this.getContentPane().add(jLabel7, new XYConstraints(27, 120, 64, 39));
this.getContentPane().add(jLabel8, new XYConstraints(10, 157, 101, 40));
this.getContentPane().add(jLabel9, new XYConstraints(27, 198, 61, 41));
this.getContentPane().add(button2, new XYConstraints(198, 271, 96, -1));
}
public void setBak(){
((JPanel)this.getContentPane()).setOpaque(false);
ImageIcon img = new ImageIcon("3.jpg");
JLabel background = new JLabel(img);this.getLayeredPane().add(background, new Integer(Integer.MIN_VALUE));
background.setBounds(0, 0, img.getIconWidth(), img.getIconHeight());
}
void button2_actionPerformed(ActionEvent e) {
String m2m="";
if(textField1.getText().equals("")||textField2.getText().equals("")||
textField3.getText().equals("")||textField4.getText().equals("")||textField5.getText().equals("")
||textField6.getText().equals("")||textField7.getText().equals("")){
m2m += "请输入员工信息,返回!";
JOptionPane.showMessageDialog(this,m2m);}
else{
/*连接数据库*/
String url = "jdbc:odbc:PMS";
//取得连接的url名,注是access的dsn名
Connection con;
//实例化一个Connection对象
Statement stmt;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//加载jdbc-odbc桥驱动
} catch(java.lang.ClassNotFoundException ee) {
System.err.print("ClassNotFoundException: ");
//加载jdbc-odbc桥错误
System.err.println(ee.getMessage());
//其他错误
}
try {
con = DriverManager.getConnection(url);
//数据库连接
stmt = con.createStatement();
String strInsert="INSERT INTO 员工信息表 (员工编号,姓名,性别,所在部门,职位,家庭住址,电话,基本工资) VALUES ('"+textField1.getText().toString()+
"','"+textField2.getText().toString()+"','"+textField9.getText().toString()+"','"+textField3.getText().toString()+
"','"+textField6.getText().toString()+"','"+textField5.getText().toString()+"','"+textField4.getText().toString()+
"','"+textField7.getText().toString()+"' )";
stmt.execute(strInsert);
String pop = "";
pop += "增加的员工信息为:";
pop +="\n";
pop +=textField1.getText().toString();
pop +="\n";
pop +=textField2.getText().toString();
pop +="\n";
pop +=textField9.getText().toString();
pop +="\n";
pop +=textField3.getText().toString();
pop +="\n";
pop +=textField6.getText().toString();
pop +="\n";
pop +=textField7.getText().toString();
pop +="\n";
pop +=textField4.getText().toString();
pop +="\n";
pop +=textField5.getText().toString();
pop +="\n";
JOptionPane.showMessageDialog(this
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
JBuilder做的员工管理系统 (129个子文件)
Modify.class 8KB
Add.class 7KB
Inquest.class 7KB
Frame1.class 6KB
Delete.class 5KB
Application1.class 1KB
Inquest_textField1_actionAdapter.class 654B
Frame1_menuItem1_actionAdapter.class 645B
Inquest_button1_actionAdapter.class 645B
Frame1_menuItem2_actionAdapter.class 645B
Frame1_menuItem3_actionAdapter.class 645B
Frame1_menuItem4_actionAdapter.class 645B
Frame1_menuItem5_actionAdapter.class 645B
Modify_jButton1_actionAdapter.class 642B
Delete_button1_actionAdapter.class 639B
Add_textField2_actionAdapter.class 630B
Add_button2_actionAdapter.class 621B
test.dep2 22KB
Frame1.html 592B
录入.html 592B
package.html 460B
package.html~1~ 529B
Add.java 9KB
Modify.java 8KB
Inquest.java 8KB
Frame1.java 6KB
Delete.java 4KB
Application1.java 1KB
录入.java~10~ 4KB
Frame1.java~112~ 6KB
Frame1.java~113~ 6KB
Frame1.java~114~ 6KB
Frame1.java~115~ 6KB
Frame1.java~116~ 6KB
Frame1.java~117~ 6KB
Frame1.java~118~ 6KB
Frame1.java~119~ 6KB
Frame1.java~120~ 6KB
Frame1.java~121~ 6KB
查询.java~1~ 2KB
Application1.java~1~ 1KB
删除.java~1~ 1KB
修改.java~1~ 1KB
录入.java~1~ 252B
录入.java~2~ 2KB
查询.java~2~ 2KB
删除.java~2~ 1KB
修改.java~2~ 1KB
Inquest.java~37~ 7KB
Inquest.java~38~ 7KB
Inquest.java~39~ 7KB
录入.java~3~ 2KB
查询.java~3~ 2KB
修改.java~3~ 1KB
Inquest.java~40~ 7KB
Inquest.java~41~ 7KB
Inquest.java~42~ 7KB
Inquest.java~43~ 7KB
Inquest.java~44~ 7KB
Inquest.java~45~ 8KB
Inquest.java~46~ 8KB
录入.java~4~ 3KB
查询.java~4~ 2KB
Delete.java~52~ 4KB
Add.java~53~ 9KB
Delete.java~53~ 4KB
Add.java~54~ 9KB
Delete.java~54~ 4KB
Add.java~55~ 9KB
Delete.java~55~ 4KB
Add.java~56~ 9KB
Delete.java~56~ 4KB
Add.java~57~ 9KB
Delete.java~57~ 4KB
Add.java~58~ 9KB
Delete.java~58~ 4KB
Add.java~59~ 9KB
Modify.java~59~ 8KB
Delete.java~59~ 4KB
查询.java~5~ 2KB
录入.java~5~ 658B
Add.java~60~ 9KB
Modify.java~60~ 8KB
Delete.java~60~ 4KB
Add.java~61~ 9KB
Modify.java~61~ 8KB
Delete.java~61~ 4KB
Add.java~62~ 9KB
Modify.java~62~ 8KB
Modify.java~63~ 8KB
Modify.java~64~ 8KB
Modify.java~65~ 8KB
Modify.java~66~ 8KB
Modify.java~67~ 8KB
Modify.java~68~ 8KB
录入.java~6~ 4KB
查询.java~6~ 2KB
录入.java~7~ 4KB
查询.java~7~ 2KB
录入.java~8~ 4KB
共 129 条
- 1
- 2
资源评论
ragucm
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功