华侨大学厦门工学院《面向对象程序设计实践》课程实验报告(分组实验)实验名称 __ 员工基本信息管理系统_ __系部 __ 计算机科学与工程系_____班级 ___ 软件3班____________小组名称 ______ 第三组_____________指导老师文欣计算机科学与工程系2014年06月12日一、实验名称员工基本信息管理系统二、实验目的及任务要求目的:对员工的信息进行有效的管理和储存任务要求:对员工的信息进行增加,删除,查找,修改等功能三、实验环境eclipse.exe四、实验内容//注册用户import javax.swing.*;import java.awt.*;import java.awt.Event.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.*;public class UserRegister extends JFrame implements ActionListener { JLabel lblUserName;JLabel lblUserPwd;JTextField txtUserName;JPasswordField txtUserPwd;JButton btnRegister;JButton btnCancel;public UserRegister() {super("用户注册");lblUserName = new JLabel("用户名");lblUserName.setBounds(40, 40, 70, 50);txtUserName = new JTextField(10);txtUserName.setBounds(120, 50, 100, 24);lblUserPwd = new JLabel("密码");lblUserPwd.setBounds(40, 70, 70, 50);txtUserPwd = new JPasswordField(10);txtUserPwd.setEchoChar('*');txtUserPwd.setBounds(120, 85, 100, 24);btnRegister = new JButton("注册");btnRegister.setBounds(55, 135, 60, 30);btnCancel = new JButton("取消");btnCancel.setBounds(140, 135, 60, 30);Container cc = this.getContentPane();cc.setLayout(null);cc.add(lblUserName);cc.add(txtUserName);cc.add(lblUserPwd);cc.add(txtUserPwd);cc.add(btnRegister);cc.add(btnCancel);btnRegister.addActionListener(this);btnCancel.addActionListener(this);this.setDefaultCloseOperation(EXIT_ON_CLOSE);this.setLocation(300, 200);this.setSize(270, 220);this.setResizable(false);this.setVisible(true);}public void actionPerformed(ActionEvent e) {if (e.getSource() == btnRegister) {DataBaseManager db = new DataBaseManager();String username = txtUserName.getText().trim();char[] pwd = txtUserPwd.getPassword();String password = new String(pwd);password = password.trim();if (username.equals("") || password.equals("")) { System.out.println(username.trim());JOptionPane.showMessageDialog(null, "用户名或密码不能为空");return;}String sql = "select * from user where username=" + "'" + username + "'";ResultSet rs = db.getResult(sql);try {if (rs.next()) {JOptionPane.showMessageDialog(null, "该用户名已存在!", "Message",JOptionPane.DEFAULT_OPTION);}else {sql = "insert into user values(" + "'" + username + "'"+ ",'" + password + "')";db.updateSql(sql);System.out.println(sql);JOptionPane.showMessageDialog(null, "注册成功!", "Message",JOptionPane.DEFAULT_OPTION);}}catch (Exception ee) {System.out.println(ee.getMessage());} finally {db.closeConnection();}}else if (e.getSource() == btnCancel) {this.dispose();}}public static void main(String args[]) {new UserRegister();}}//用户登录import java.awt.Color;import java.awt.Dimension;import java.awt.FlowLayout;import java.awt.Font;import java.awt.HeadlessException;import java.awt.Toolkit;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.DriverManager;import java.sql.Statement;import java.sql.Connection;import java.sql.ResultSet;import java.sql.SQLException;import javax.swing.AbstractButton;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JPasswordField;import javax.swing.JTextField;class Login extends JFrame implements ActionListener { //JLabel j1 = null;JTextField text = null;//JLabel j2 = null;JLabel j3 = null;JLabel j4 = null;JPasswordField pass = null;JTextField text1 =null;JButton b1 = null;JButton b2 = null;Font fnt = new Font("方正舒体", Font.BOLD, 20);JPanel p=new ImagePanel("F:\\my picture\\验证码 .jpg");JPanel jpanel=new ImagePanel("F:\\my picture\\登录界面.jpg"); public Login(String title) throws HeadlessException { super(title);// TODO Auto-generated constructor stub//j1 = new JLabel("用户名");//j1.setFont(fnt);//j1.setForeground(Color.white);text = new JTextField(10);text.setFont(fnt);text.setForeground(Color.black);text.setOpaque(false);text.setBorder(null);text1=new JTextField(10);text1.setFont(fnt);text1.setForeground(Color.black);text1.setOpaque(false);text1.setBorder(null);//j2 = new JLabel("密码");//j2.setFont(fnt);//j2.setForeground(Color.white);j3=new JLabel(" ");j3.setFont(fnt);j3.setForeground(Color.white);pass = new JPasswordField(10);pass.setEchoChar('*');pass.setFont(new Font("",Font.ITALIC,15));pass.setForeground(Color.black);pass.setOpaque(false);pass.setBorder(null);b1 = new JButton(" ");b1.setFont(fnt);b1.setForeground(Color.white);b1.setContentAreaFilled(false);b1.setBorder(null);b2 = new JButton(" ");b2.setFont(fnt);b2.setForeground(Color.white);b2.setContentAreaFilled(false);b2.setBorder(null);int xcenter =155;int ycenter = 50;setLocation(xcenter, ycenter);jpanel.setLayout(null);setSize(1050,680);p.setBounds(750,371,82,28);//j1.setBounds(40, 40, 70, 30);text.setBounds(538, 283, 177, 30);//j2.setBounds(40, 100, 70, 50);pass.setBounds(538, 326, 177, 30);text1.setBounds(538,370,177,30);b1.setBounds(531, 444, 76, 23);b2.setBounds(646, 444, 76, 23);//jpanel.add(j1);jpanel.add(text);//jpanel.add(j2);jpanel.add(pass);jpanel.add(text1);jpanel.add(b1);jpanel.add(b2);jpanel.add(p);this.getContentPane().add(jpanel);b1.addActionListener(this);b2.addActionListener(this);this.setResizable(false);this.setVisible(true);}public void actionPerformed(ActionEvent e) { DataBaseManager db = new DataBaseManager();String sql = "select * from user";ResultSet rs = db.getResult(sql);boolean flag = false;if (e.getSource() == b1) {try {while (rs.next()) {boolean flag1 = text.getText().trim().equals(rs.getString(1));boolean flag2 = pass.getText().trim().equals(rs.getString(2));if (flag1 && flag2) {if(text1.getText().trim().equals("xahv")){flag = true;JOptionPane.showMessageDialog(this, "成功登陆");dispose();new StaffMain("员工信息管理系统");// TODO Auto-generated method stub}else{flag = true;JOptionPane.showMessageDialog(this, "验证码错误");//dispose();}}}if (flag == false) {JOptionPane.showMessageDialog(this, "用户名或密码错误" );text.setText("");pass.setText("");}}catch (SQLException e1) {// TODO Auto-generated catch blocke1.printStackTrace();}}if (e.getSource() == b2) {text.setText("");text1.setText("");pass.setText("");}}}public class TestLogin {/*** @param args*/public static void main(String[] args) { // TODO Auto-generated method stubnew Login("登陆");}}//主界面import java.awt.BorderLayout;import java.awt.Color;import java.awt.Container;import java.awt.Dimension;import java.awt.FlowLayout;import java.awt.Font;import java.awt.Frame;import java.awt.Graphics;import java.awt.GridLayout;import java.awt.HeadlessException;import java.awt.Image;import java.awt.Toolkit;import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.Transferable; import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.InputEvent;import javax.swing.*;public class StaffMain extends JFrame implements ActionListener { private Font fnt = new Font("方正舒体", Font.BOLD, 25);private JButton j1 = new JButton("add~增加员工信息 ");private JButton j2 = new JButton("edit~修改员工信息 ");private JButton j3 = new JButton("del~删除员工信息 ");private JButton j4 = new JButton("query~查找员工信息 ");private JButton j5 = new JButton("all~所有员工信息 ");private JButton j6 = new JButton("exit~关于系统 ");private JLabel label = new JLabel("欢迎进入员工管理系统");private JPanel jpanel1 = new ImagePanel("f:\\my picture\\6f470395853e7f507bf480bb.jpg");public StaffMain(String s) throws HeadlessException { super(s);// TODO Auto-generated constructor stubContainer c = getContentPane();c.setLayout(new BorderLayout());setLocation(283, 84);setSize(800, 600);init();c.add(jpanel1);j1.addActionListener(this);j2.addActionListener(this);j3.addActionListener(this);j4.addActionListener(this);j5.addActionListener(this);j6.addActionListener(this);setResizable(false);setVisible(true);}void init() {jpanel1.setLayout(null);j1.setBounds(410, 100, 350, 30); j2.setBounds(380, 140, 350, 30); j3.setBounds(420, 180, 350, 30); j4.setBounds(390, 220, 350, 30); j5.setBounds(420, 260, 350, 30); j6.setBounds(390, 300, 350, 30); label.setBounds(185, 20, 450, 35); j1.setForeground(Color.white);j2.setForeground(Color.white);j3.setForeground(Color.white);j4.setForeground(Color.white);j5.setForeground(Color.white);j6.setForeground(Color.white); label.setForeground(Color.white); j1.setContentAreaFilled(false);j1.setBorder(null);j2.setContentAreaFilled(false);j2.setBorder(null);j3.setContentAreaFilled(false);j3.setBorder(null);j4.setContentAreaFilled(false);j4.setBorder(null);j5.setContentAreaFilled(false);j5.setBorder(null);j6.setContentAreaFilled(false);j6.setBorder(null);jpanel1.add(j1);jpanel1.add(j2);jpanel1.add(j3);jpanel1.add(j4);jpanel1.add(j5);jpanel1.add(j6);jpanel1.add(label);j1.setFont(fnt);j2.setFont(fnt);j3.setFont(fnt);j4.setFont(fnt);j5.setFont(fnt);j6.setFont(fnt);label.setFont(new Font("方正舒体", Font.BOLD, 40));}public void actionPerformed(ActionEvent e) {// TODO Auto-generated method stubif (e.getSource() == j1) {dispose();new StaffAdd("增加员工信息");} else if (e.getSource() == j2) {dispose();new StaffUpdate("修改员工信息 ");} else if (e.getSource() == j3) {dispose();new StaffDelete();} else if (e.getSource() == j4) {dispose();new StaffQuery("查找员工信息");} else if (e.getSource() == j5) {dispose();new StaffAll();} else if (e.getSource() == j6) {new About();}}public static void main(String[] args) {// TODO Auto-generated method stubnew StaffMain("员工信息管理系统");}}//增加员工信息import java.awt.BorderLayout;import java.awt.Color;import java.awt.Container;import java.awt.Dimension;import java.awt.FlowLayout;import java.awt.Font;import java.awt.GridLayout;import java.awt.HeadlessException;import java.awt.Toolkit;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.ResultSet;import java.sql.SQLException;import javax.swing.ButtonGroup;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JRadioButton;import javax.swing.JTextField;class StaffAdd extends JFrame implements ActionListener {JPanel jpanel1 = new ImagePanel("f:\\my picture\\1.jpg");JLabel j1 = new JLabel("编号:");JLabel j2 = new JLabel("姓名:");JLabel j3 = new JLabel("性别 ");JLabel j4 = new JLabel("年龄:");JLabel j5 = new JLabel("工资:");JLabel j6 = new JLabel("地址:");JLabel j7 = new JLabel("部门:");JRadioButton radioButton1 = new JRadioButton("男"); JRadioButton radioButton2 = new JRadioButton("女"); JButton but1 = new JButton("添加 ");JButton but2 = new JButton("关闭 ");JButton but3 = new JButton("返回主菜单");Font fnt=new Font("方正舒体",Font.BOLD,25);JTextField text1 = new JTextField(10);JTextField text2 = new JTextField(10);JTextField text3 = new JTextField(10);JTextField text4 = new JTextField(10);JTextField text5 = new JTextField(10);JTextField text6 = new JTextField(10);ButtonGroup bg = new ButtonGroup();public StaffAdd(String s) throws HeadlessException { super(s);// TODO Auto-generated constructor stubStaffInit();jpanel1.add(j1);jpanel1.add(text1);jpanel1.add(j2);jpanel1.add(text2);jpanel1.add(j3);bg.add(radioButton1);bg.add(radioButton2);jpanel1.add(radioButton1);jpanel1.add(radioButton2);jpanel1.add(j4);jpanel1.add(text3);jpanel1.add(j5);jpanel1.add(text4);jpanel1.add(j6);jpanel1.add(text5);jpanel1.add(j7);jpanel1.add(text6);jpanel1.add(but1);jpanel1.add(but2);jpanel1.add(but3);this.getContentPane().add(jpanel1);but1.addActionListener(this);but2.addActionListener(this);but3.addActionListener(this);Toolkit kit = Toolkit.getDefaultToolkit();Dimension screen = kit.getScreenSize();int x = screen.width; /* 取得显示器窗口的宽度 */ int y = screen.height;setSize(820, 620);int xcenter = (x - 820) / 2;int ycenter = (y - 620) / 2;setLocation(xcenter, ycenter);setResizable(false);setVisible(true);}public void StaffInit(){jpanel1.setLayout(null);j1.setFont(fnt);j2.setFont(fnt);j3.setFont(fnt);j4.setFont(fnt);j5.setFont(fnt);j6.setFont(fnt);j7.setFont(fnt);text1.setFont(fnt);text2.setFont(fnt);text3.setFont(fnt);text4.setFont(fnt);text5.setFont(fnt);text6.setFont(fnt);but1.setFont(fnt);but2.setFont(fnt);but3.setFont(fnt);radioButton1.setFont(fnt);radioButton2.setFont(fnt);j1.setBounds(50,50,80,30);j2.setBounds(250,50,80,30);j4.setBounds(50,100,80,30);j5.setBounds(250,100,80,30);j6.setBounds(50,150,80,30);j7.setBounds(250,150,80,30);text1.setBounds(119,52,100,30);text2.setBounds(319,52,100,30);text3.setBounds(119,102,100,30);text4.setBounds(319,102,100,30);text5.setBounds(119,152,100,30);text6.setBounds(319,152,100,30);j3.setBounds(50,200,80,30);radioButton1.setBounds(150,203,85,30); radioButton2.setBounds(250,203,85,30); but1.setBounds(135,240,100,30);but2.setBounds(135,290,100,30);but3.setBounds(95,340,170,30);text1.setOpaque(false);text1.setBorder(null);text2.setOpaque(false);text2.setBorder(null);text3.setOpaque(false);text3.setBorder(null);text4.setOpaque(false);text4.setBorder(null);text5.setOpaque(false);text5.setBorder(null);text6.setOpaque(false);text6.setBorder(null);radioButton1.setContentAreaFilled(false); radioButton2.setContentAreaFilled(false); but1.setContentAreaFilled(false);but1.setBorder(null);but2.setContentAreaFilled(false);but2.setBorder(null);but3.setContentAreaFilled(false);but3.setBorder(null);j1.setForeground(Color.white);j2.setForeground(Color.white);j3.setForeground(Color.white);j4.setForeground(Color.white);j5.setForeground(Color.white);j6.setForeground(Color.white);j7.setForeground(Color.white);j1.setForeground(Color.white);text1.setForeground(Color.white);text2.setForeground(Color.white);text3.setForeground(Color.white);text4.setForeground(Color.white);text5.setForeground(Color.white);text6.setForeground(Color.white);but1.setForeground(Color.white);but2.setForeground(Color.white);but3.setForeground(Color.white);radioButton1.setForeground(Color.white);radioButton2.setForeground(Color.white);}public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stubDataBaseManager db = new DataBaseManager();String ID = text1.getText().trim();String sql = "select ID from staff";int flag = 0;if (e.getSource() == but1) {ResultSet rs = db.getResult(sql);try {while(rs.next())if (ID.equals(rs.getString(1))) {flag = 1;break;}} catch (SQLException e1) {// TODO Auto-generated catch blocke1.printStackTrace();}if (flag == 1) {JOptionPane.showMessageDialog(this, "编号相同不能插入");text1.setText("");text2.setText("");text3.setText("");text4.setText("");text5.setText("");text6.setText("");}if (flag == 0) {init();}} else if (e.getSource() == but2) {System.exit(0);} else {this.hide();new StaffMain("员工信息管理系统");}}public void init() {String sql;String s1 = text1.getText().trim();String s2 = text2.getText().trim();String s3 = radioButton1.getText();String s4 = radioButton2.getText();String s5 = text3.getText().trim();String s6 = text4.getText().trim();String s7 = text5.getText().trim();String s8 = text6.getText().trim();if (radioButton1.isSelected()) {sql = "insert into staff values('" + s1 + "','" + s2 + "','" + s3 + "','" + s5 + "','" + s6 + "','" + s7 + "','" + s8 + "')";new DataBaseManager().updateSql(sql);JOptionPane.showMessageDialog(this, "添加成功!", "提示",RMATION_MESSAGE);text1.setText("");text2.setText("");text3.setText("");text4.setText("");text5.setText("");text6.setText("");} else if (radioButton2.isSelected()) {sql = "insert into staff values('" + s1 + "','" + s2 + "','" + s4 + "','" + s5 + "','" + s6 + "','" + s7 + "','" + s8 + "')";new DataBaseManager().updateSql(sql);JOptionPane.showMessageDialog(this, "添加成功!", "提示",RMATION_MESSAGE);text1.setText("");text2.setText("");text3.setText("");text4.setText("");text5.setText("");text6.setText("");} else {JOptionPane.showMessageDialog(this, "请选择性别", "提示",RMATION_MESSAGE);}}public static void main(String args[]) {new StaffAdd("增加员工信息");}}//修改员工信息import java.awt.BorderLayout;import java.awt.Color;import java.awt.Container;import java.awt.FlowLayout;import java.awt.Font;import java.awt.GridLayout;import java.awt.HeadlessException;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.ItemEvent;import java.awt.event.ItemListener;import java.sql.ResultSet;import java.sql.SQLException;import java.util.Vector;import javax.swing.BorderFactory;import javax.swing.JButton;import javax.swing.JComboBox;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JTextField;class StaffUpdate extends JFrame implements ActionListener, ItemListener { private JComboBox jcb;private JLabel jlabel = new JLabel("按编号修改:");private JLabel j1 = new JLabel("姓名: ");private JLabel j2 = new JLabel("性别: ");private JLabel j3 = new JLabel("年龄: ");private JLabel j4 = new JLabel("工资: ");private JLabel j5 = new JLabel("地址: ");private JLabel j6 = new JLabel("部门: ");private JTextField text1 = new JTextField(25);private JTextField text2 = new JTextField(25);private JTextField text3 = new JTextField(25);private JTextField text4 = new JTextField(25);private JTextField text5 = new JTextField(25);private JTextField text6 = new JTextField(25);private JPanel panel1 = new ImagePanel("F:\\my picture\\111 (2).jpg");private JButton but1 = new JButton("修改");private JButton but2 = new JButton("清除");private JButton but3 = new JButton("返回主菜单 "); private Font fnt=new Font("方正舒体",Font.BOLD ,25);private Container con = getContentPane();public StaffUpdate(String s) throws HeadlessException { super(s);panel1.setLayout(null);init();jcb.setOpaque(false);jlabel.setBounds(150,30,280,50);jcb.setBounds(295,40,100,30);j1.setBounds(20,100,100,50);j2.setBounds(20,150,120,50);j3.setBounds(20,200,120,50);j4.setBounds(20,250,120,50);j5.setBounds(20,300,120,50);j6.setBounds(20,350,120,50);but1.setBounds(80,435,100,30);but2.setBounds(200,435,100,30);but3.setBounds(115,485,180,30);text1.setBounds(85,111,80,30);text2.setBounds(85,161,80,30);text3.setBounds(85,211,80,30);text4.setBounds(85,261,80,30);text5.setBounds(85,311,80,30);text6.setBounds(85,361,80,30);text1.setOpaque(false);text1.setBorder(null);text2.setOpaque(false);text2.setBorder(null);text3.setOpaque(false);text3.setBorder(null);text4.setOpaque(false);text4.setBorder(null);text5.setOpaque(false);text5.setBorder(null);text6.setOpaque(false);text6.setBorder(null);but1.setContentAreaFilled(false);but1.setBorder(null);but2.setContentAreaFilled(false);but2.setBorder(null);but3.setContentAreaFilled(false);but3.setBorder(null);jlabel.setFont(fnt);jcb.setFont(fnt);j1.setFont(fnt);j2.setFont(fnt);j3.setFont(fnt);j4.setFont(fnt);j5.setFont(fnt);j6.setFont(fnt);text1.setFont(fnt);text2.setFont(fnt);text3.setFont(fnt);text4.setFont(fnt);text5.setFont(fnt);text6.setFont(fnt);but1.setFont(fnt);but2.setFont(fnt);but3.setFont(fnt);panel1.add(jlabel);panel1.add(jcb);panel1.add(j1);panel1.add(j2);panel1.add(j3);panel1.add(j4);panel1.add(j5);panel1.add(j6);panel1.add(text1);panel1.add(text2);panel1.add(text3);panel1.add(text4);panel1.add(text5);panel1.add(text6);panel1.add(but1);panel1.add(but2);panel1.add(but3);con.add(panel1);but1.addActionListener(this);but2.addActionListener(this);but3.addActionListener(this);jcb.addItemListener(this);setBounds(258, 57, 850, 650);setVisible(true);}public void init() {DataBaseManager db = new DataBaseManager();String sql = "select * from staff";ResultSet rs = db.getResult(sql);Object s1[] = new Object[100];int i = 0;try {while (rs.next()) {s1[i] = rs.getString(1);i++;text1.setText(rs.getString("name"));text2.setText(rs.getString("sex"));text3.setText(rs.getString("age"));text4.setText(rs.getString("wage"));text5.setText(rs.getString("address"));text6.setText(rs.getString("department"));}} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}jcb = new JComboBox(s1);}public void itemStateChanged(ItemEvent e) {// TODO Auto-generated method stubif (e.getStateChange() == ItemEvent.SELECTED) {// 判断是否是选中String s = (String) e.getItem();// 返回受事件影响的项DataBaseManager db = new DataBaseManager();String sql = "select name,sex,age,wage,address,department from staff where ID="+ "'" + s + "'";ResultSet rs = db.getResult(sql);try {while (rs.next()) {text1.setText(rs.getString("name"));text2.setText(rs.getString("sex"));text3.setText(rs.getString("age"));text4.setText(rs.getString("wage"));text5.setText(rs.getString("address"));text6.setText(rs.getString("department"));}} catch (SQLException e1) {// TODO Auto-generated catch blocke1.printStackTrace();}}}public void actionPerformed(ActionEvent e) {// TODO Auto-generated method stubif (e.getSource() == but1) {DataBaseManager db = new DataBaseManager();String s1 = (String) jcb.getSelectedItem();// 返回被选项String s2 = text1.getText();String s3 = text2.getText();String s4 = text3.getText();String s5 = text4.getText();String s6 = text5.getText();String s7 = text6.getText();String sql = "update staff set name=" + "'" + s2 + "',sex='" + s3 + "',age='" + s4 + "',wage='" + s5 + "',address='" + s6+ "',department='" + s7 + "'where ID=" + "'" + s1 + "'";db.updateSql(sql);JOptionPane.showMessageDialog(this, "成功修改 ");} else if (e.getSource() == but2) {String s1 = (String) jcb.getSelectedItem();text1.setText("");text2.setText("");text3.setText("");text4.setText("");text5.setText("");text6.setText("");String s2 = text1.getText();String s3 = text2.getText();String s4 = text3.getText();String s5 = text4.getText();String s6 = text5.getText();String s7 = text6.getText();String sql = "update staff set name=" + "'" + s2 + "',sex='" + s3 + "',age='" + s4 + "',wage='" + s5 + "',address='" + s6+ "',department='" + s7 + "'where ID=" + "'" + s1 + "'";DataBaseManager db = new DataBaseManager();db.updateSql(sql);} else {dispose();new StaffMain("员工信息管理系统");}}public static void main(String[] args) {// TODO Auto-generated method stubnew StaffUpdate("修改员工信息 ");}}//删除员工信息import java.awt.Color;import java.awt.Container;import java.awt.FlowLayout;import java.awt.Font;import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.ItemEvent;import java.awt.event.ItemListener;import java.sql.ResultSet;import java.sql.SQLException;import javax.swing.JButton;import javax.swing.JComboBox;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JTextField;public class StaffDelete extends JFrame implements ActionListener { /****/private JLabel j1;//设置标签private JLabel j2;private JLabel j3;private JLabel j4;private JLabel j5;private JLabel j6;private JTextField text;//设置文本框private JTextField text1;private JTextField text2;private JTextField text3;private JTextField text4;private JTextField text5;private JTextField text6;private JButton but1;//设置按钮private JLabel jlabel;private JButton delete;private JButton returnButton;private Font fnt;//设置字体private Font fnt1;private JPanel panel1;//定义一个面板public StaffDelete() {super("删除员工信息");init();panel1.setLayout(null);//设置布局管理器panel1.add(but1);panel1.add(jlabel);panel1.add(j1);panel1.add(j2);panel1.add(j3);panel1.add(j4);panel1.add(j5);panel1.add(j6);panel1.add(text);panel1.add(text1);panel1.add(text2);panel1.add(text3);panel1.add(text4);panel1.add(text5);panel1.add(text6);panel1.add(delete);panel1.add(returnButton);setBounds(256, 57, 850, 650);this.getContentPane().add(panel1);setVisible(true);}void init() {panel1 = new ImagePanel("F:\\my picture\\1_120414121442_5.jpg");fnt = new Font("方正舒体", Font.BOLD, 30);fnt1 = new Font("华文新魏", Font.BOLD, 25);j1 = new JLabel("姓名:");j2 = new JLabel("性别:");j3 = new JLabel("年龄:");j4 = new JLabel("工资:");j5 = new JLabel("地址:");j6 = new JLabel("部门:");text = new JTextField(10);text1 = new JTextField(10);text2 = new JTextField(10);。