📄 delempinfo.java
字号:
package employee;import java.awt.*;import java.sql.*;import java.awt.event.*;import javax.swing.*;/** * 职工信息管理模块 * 删除职工信息的类 */public class DelEmpInfo extends EmpInfo{ String eEid_str = ""; public DelEmpInfo() { this.setTitle("删除职工信息"); this.setResizable(false); eEid.setEditable(false); eEid.setText("请查询职工编号"); eName.setEditable(false); eSex.setEditable(false); eNation.setEditable(false); eRegion.setEditable(false); eEducation.setEditable(false); eSpecialty.setEditable(false); eBirthday.setEditable(false); eGstatus.setEditable(false); eMarriage.setEditable(false); eIdcard.setEditable(false); eHlocation.setEditable(false); eCityhk.setEditable(false); eCaddress.setEditable(false); ePostcode.setEditable(false); eMobilephone.setEditable(false); eHomephone.setEditable(false); eEmail.setEditable(false); //设置运行时窗口的位置 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation((screenSize.width - 400) / 2, (screenSize.height - 300) / 2 + 45); } public void downInit(){ searchInfo.setText("职工编号查询"); searchInfo.setFont(new Font("Dialog",0,12)); downPanel.add(searchInfo); deleteInfo.setText("删除"); deleteInfo.setFont(new Font("Dialog",0,12)); downPanel.add(deleteInfo); eixtInfo.setText("退出"); eixtInfo.setFont(new Font("Dialog",0,12)); downPanel.add(eixtInfo); searchInfo.setEnabled(true); deleteInfo.setEnabled(false); eixtInfo.setEnabled(true); //添加事件侦听 searchInfo.addActionListener(this); deleteInfo.addActionListener(this); eixtInfo.addActionListener(this); contentPane.add(downPanel,BorderLayout.SOUTH); } /** * 事件处理 */ public void actionPerformed(ActionEvent e) { Object obj = e.getSource(); String[] s = new String[17]; if (obj == eixtInfo) { //退出 this.dispose(); } else if (obj == deleteInfo) { //删除 int ifdel = JOptionPane.showConfirmDialog(null,"真的要删除该信息?","提示信息",JOptionPane.YES_NO_OPTION,JOptionPane.INFORMATION_MESSAGE ); if(ifdel == JOptionPane.YES_OPTION){ EmpBean delEmp = new EmpBean(); delEmp.empDel(eEid.getText()); this.dispose(); DelEmpInfo dei = new DelEmpInfo(); dei.downInit(); dei.pack(); dei.setVisible(true); } else{ return; } } else if (obj == searchInfo) { //职工编号查询 EmpInfoSearchEeid eise = new EmpInfoSearchEeid(this); eise.pack(); eise.setVisible(true); eEid_str = eise.getEeid(); EmpBean searchEmp = new EmpBean(); s = searchEmp.empSearch(eEid_str); if(s == null){ JOptionPane.showMessageDialog(null, "记录不存在!"); eEid.setText("请查询职工编号"); eName.setText(""); eSex.setText(""); eNation.setText(""); eRegion.setText(""); eEducation.setText(""); eSpecialty.setText(""); eBirthday.setText(""); eGstatus.setText(""); eMarriage.setText(""); eIdcard.setText(""); eHlocation.setText(""); eCityhk.setText(""); eCaddress.setText(""); ePostcode.setText(""); eMobilephone.setText(""); eHomephone.setText(""); eEmail.setText(""); deleteInfo.setEnabled(false); return; } else{ eEid.setText(eEid_str); eName.setText(s[0]); eSex.setText(s[1]); eNation.setText(s[2]); eRegion.setText(s[3]); eEducation.setText(s[4]); eSpecialty.setText(s[5]); eBirthday.setText(s[6]); eGstatus.setText(s[7]); eMarriage.setText(s[8]); eIdcard.setText(s[9]); eHlocation.setText(s[10]); eCityhk.setText(s[11]); eCaddress.setText(s[12]); ePostcode.setText(s[13]); eMobilephone.setText(s[14]); eHomephone.setText(s[15]); eEmail.setText(s[16]); deleteInfo.setEnabled(true); } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -