📄 addappinfo.java
字号:
package employee;
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
/**
* 职务信息管理模块
* 添加新的职务信息
*/
public class AddAppInfo extends AppInfo{
AppBean getAaid = new AppBean();
public AddAppInfo() {
this.setTitle("添加部门信息");
this.setResizable(false);
aAid.setEditable(false);
aName.setEditable(true);
//设置运行位置,使对话框居中
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation( (int) (screenSize.width - 400) / 2 ,
(int) (screenSize.height - 300) / 2 +45);
}
public void downInit(){
addInfo.setText("添加");
addInfo.setFont(new Font("Dialog",0,12));
downPanel.add(addInfo);
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);
//添加事件侦听
addInfo.addActionListener(this);
clearInfo.addActionListener(this);
eixtInfo.addActionListener(this);
}
/**
* 事件处理
*/
public void actionPerformed(ActionEvent e) {
Object obj = e.getSource();
if (obj == eixtInfo) { //退出
this.dispose();
}
else if (obj == addInfo) { //添加
aAid.setEnabled(false);
aName.setEditable(false);
addInfo.setEnabled(false);
clearInfo.setEnabled(false);
eixtInfo.setEnabled(false);
AppBean addApp = new AppBean();
addApp.appAdd(aName.getText());
this.dispose();
AddAppInfo aai = new AddAppInfo();
aai.downInit();
aai.pack();
aai.setVisible(true);
this.dispose();
}
else if (obj == clearInfo) { //清空
setNull();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -