📄 editappinfo.java
字号:
package employee;
import java.awt.*;
import java.sql.*;
import java.awt.event.*;
import javax.swing.*;
public class EditAppInfo extends AppInfo {
String aName_str = "";
public EditAppInfo() {
this.setTitle("修改职务信息");
this.setResizable(false);
aAid.setEditable(false);
aName.setText("请查询职务名称");
aName.setEditable(false);
//设置运行位置,使对话框居中
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation( (int) (screenSize.width - 400) / 2 ,
(int) (screenSize.height - 300) / 2 +45);
}
public void downInit(){
searchInfo.setText("职务名称查询");
searchInfo.setFont(new Font("Dialog",0,12));
downPanel.add(searchInfo);
modifyInfo.setText("修改");
modifyInfo.setFont(new Font("Dialog",0,12));
downPanel.add(modifyInfo);
clearInfo.setText("清空");
clearInfo.setFont(new Font("Dialog",0,12));
downPanel.add(clearInfo);
eixtInfo.setText("退出");
eixtInfo.setFont(new Font("Dialog",0,12));
downPanel.add(eixtInfo);
this.contentPane.add(downPanel,BorderLayout.SOUTH);
searchInfo.setEnabled(true);
modifyInfo.setEnabled(false);
clearInfo.setEnabled(true);
eixtInfo.setEnabled(true);
//添加事件侦听
searchInfo.addActionListener(this);
modifyInfo.addActionListener(this);
clearInfo.addActionListener(this);
eixtInfo.addActionListener(this);
}
/**
* 事件处理
*/
public void actionPerformed(ActionEvent e) {
Object obj = e.getSource();
String[] s = new String[1];
if (obj == eixtInfo) { //退出
this.dispose();
}
else if (obj == modifyInfo) { //修改
AppBean modifyApp = new AppBean();
modifyApp.appModify(aAid.getText(), aName.getText());
modifyApp.appSearch(aName.getText());
s = modifyApp.appSearch(aName_str);
aAid.setText(s[0]);
}
else if (obj == clearInfo) { //清空
setNull();
aName.setText("请查询职务名称");
}
else if (obj == searchInfo) { //职务名称查询
AppInfoSearchAname aisa = new AppInfoSearchAname(this);
aisa.pack();
aisa.setVisible(true);
aName_str = aisa.getAname();
AppBean searchApp = new AppBean();
s = searchApp.appSearch(aName_str);
if(s == null){
JOptionPane.showMessageDialog(null, "记录不存在!");
aAid.setText("");
aName.setText("请查询职务名称");
aName.setEditable(false);
modifyInfo.setEnabled(false);
return;
}
else{
aAid.setText(s[0]);
aName.setText(aName_str);
aName.setEditable(true);
modifyInfo.setEnabled(true);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -