当前位置:首页 > JAVA课设职工信息管理系统
{
}
}
contentPane.add(dialogPane, BorderLayout.CENTER); setSize(625, 260);
setLocationRelativeTo(getOwner()); show(); }
dialogPane.add(buttonBar, BorderLayout.SOUTH);
btn_close.setText(\关闭\);
btn_close.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { }
btn_closeActionPerformed(e);
btn_save.setText(\保存\);
btn_save.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { }
btn_saveActionPerformed(e);
0, 85, 80 };
((GridBagLayout) buttonBar.getLayout()).columnWeights = new
1.0, 0.0, 0.0 };
{
buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); buttonBar.setLayout(new GridBagLayout());
((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[]
}
dialogPane.add(contentPanel, BorderLayout.CENTER);
lb_age.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lb_age); contentPanel.add(tf_age);
double[] {
});
buttonBar.add(btn_save, new GridBagConstraints(1, 0, 1, 1, 0.0,
0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0));
});
buttonBar.add(btn_close, new GridBagConstraints(2, 0, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
- 22 -
}
private void btn_queryActionPerformed(ActionEvent e) { }
private void btn_closeActionPerformed(ActionEvent e) { }
dispose(); }
String id = tf_cx_id.getText(); // 职工号
Staff staff = StaffDao.selectStaff(id); // 根据编号查询职工信息 if (staff != null) { }
tf_id.setText(staff.getId()); tf_name.setText(staff.getName());
cb_type.setSelectedItem(staff.getType()); tf_xueli.setText(staff.getXueli()); tf_address.setText(staff.getAddress()); tf_sex.setText(staff.getSex());
tf_salary.setText(String.valueOf(staff.getSalary())); tf_age.setText(String.valueOf(staff.getAge())); // 执行数据库操作
int i = BaseDao.executeUpdate(sql); if (i == 1) { }
JOptionPane.showMessageDialog(null, \修改成功\); dispose();
// 拼接sql
String sql = \ + name + \ + type
+ \ + xueli + \ + address + \ + sex + \ + Double.parseDouble(salary) + \ + age + \ + id + \;
private void btn_saveActionPerformed(ActionEvent e) {
// 获取用户输入信息
String id = tf_id.getText(); String name = tf_name.getText();
String type = cb_type.getSelectedItem().toString(); String xueli = tf_xueli.getText(); String address = tf_address.getText(); String sex = tf_sex.getText(); String salary = tf_salary.getText(); String age = tf_age.getText();
// 设置职工信息
- 23 -
3.2.5用户信息录入、更新、删除、查找
同职工信息的类似,在此不再仔细说明。
- 24 -
3.3数据库表定义
3.3.1 数据库职工信息表设计
图3.3.1 数据库职工信息表设计
25
共分享92篇相关文档