java简易员工管理系统
- 格式:doc
- 大小:852.00 KB
- 文档页数:29
主要功能:
用Swing制作管理界面,连接数据库,完成对数据库emp表进行查添改删功能。
查询:
添加:
修改:
删除:
以上功能在完成时如果在操作时发生输入格式错误,操作都不能完成,并且都会出现提示。
环境配置为oracle数据库recruit,表emp,ip127.0.0.1,用户名system,密码871108
源代码:
主界面:
package exercise.emp;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import ponentAdapter;
import ponentEvent;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Vector;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
public class UserManager extends JFrame implements ActionListener {
private JPanel penter = new JPanel();
private JPanel pcontrol = new JPanel();
private JLabel lid = new JLabel("编号:");
private JLabel lid2 = new JLabel("编号:");
private JLabel lname = new JLabel("姓名:");
private JLabel lname2 = new JLabel("姓名:");
private JLabel ljob = new JLabel("职位:");
private JLabel ljob2 = new JLabel("职位:");
private JLabel lsalary = new JLabel("工资:");
private JLabel lsalary2 = new JLabel("工资:");
private JLabel ldeptid = new JLabel("部门编号:");
private JLabel ldeptid2 = new JLabel("部门编号:");
private JLabel lupdate2 = new JLabel("修改完后请点击'修改'");
private JLabel limage = new JLabel(new ImageIcon(this.getClass() .getResource("emp.jpg")), JLabel.CENTER);
private JTextField tid = new JTextField();
private JTextField tid2 = new JTextField();
private JTextField tname = new JTextField();
private JTextField tname2 = new JTextField();
private JTextField tjob = new JTextField();
private JTextField tjob2 = new JTextField();
private JTextField tsalary = new JTextField();
private JTextField tsalary2 = new JTextField();
private JTextField tdeptid = new JTextField();
private JTextField tdeptid2 = new JTextField();
private JButton bselect = new JButton("查询");
private JButton binsert = new JButton("插入");
private JButton bdelete = new JButton("删除");
private JButton bupdate = new JButton("修改");
private JButton bupdate2 = new JButton("修改");
private JScrollPane simage = new JScrollPane(limage);
private JScrollPane stable;
private JTable ttable;
private JFrame uf;
UserModel um = null;
WindowOperate ml = null;
int id, salary, deptid;
boolean isInsert, isUpdate, isDelete;
String sid, name, job;
Vector oneemp;
public UserManager()
{
super("emp用户操作界面");
lunachframe();
ml = new WindowOperate();
ml.getAddComponentListener(this, 300, 250);
ml.getaddWindowListener(this);