📄 recordoperatepanel.java
字号:
}
final GridBagConstraints gridBagConstraints_7 = new GridBagConstraints();
gridBagConstraints_7.gridwidth = 2;
gridBagConstraints_7.insets = new Insets(5, 0, 10, 0);
gridBagConstraints_7.gridy = 0;
gridBagConstraints_7.gridx = 6;
recordInfoPanel.add(birthdayTextField, gridBagConstraints_7);
final JLabel label_2 = new JLabel();
label_2.setText(" ");
final GridBagConstraints gridBagConstraints_93 = new GridBagConstraints();
gridBagConstraints_93.insets = new Insets(0, 20, 0, 0);
gridBagConstraints_93.gridy = 0;
gridBagConstraints_93.gridx = 8;
recordInfoPanel.add(label_2, gridBagConstraints_93);
photoLabel = new JLabel();// 创建用来显示照片的对象
photoLabel.setHorizontalAlignment(SwingConstants.CENTER);// 设置照片或文字居中显示
photoLabel.setBorder(new TitledBorder(null, "",
TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION, null, null));// 设置边框
photoLabel.setPreferredSize(new Dimension(120, 140));// 设置显示照片的大小
if (UPDATE_RECORD == null || UPDATE_RECORD.getPhoto() == null) {// 新建档案或未上传照片
photoLabel.setText("双击添加照片");// 显示文字提示
} else {// 修改档案并且已上传照片
URL url = this.getClass().getResource("/personnel_photo/");// 获得指定路径的绝对路径
String photo = url.toString().substring(5)
+ UPDATE_RECORD.getPhoto();// 组织员工照片的存放路径
photoLabel.setIcon(new ImageIcon(photo));// 创建照片对象并显示
}
photoLabel.addMouseListener(new MouseAdapter() {// 添加鼠标监听器
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {// 判断是否为双击
JFileChooser fileChooser = new JFileChooser();// 创建文件选取对话框
fileChooser.setFileFilter(new FileFilter() {// 为对话框添加文件过滤器
public String getDescription() {// 设置提示信息
return "图像文件(.jpg;.gif)";
}
public boolean accept(File file) {// 设置接受文件类型
if (file.isDirectory())// 为文件夹则返回true
return true;
String fileName = file.getName()
.toLowerCase();
if (fileName.endsWith(".jpg")
|| fileName
.endsWith(".gif"))// 为JPG或JIF格式文件则返回true
return true;
return false;// 否则返回false,即不显示在文件选取对话框中
}
});
int i = fileChooser.showOpenDialog(getParent());// 弹出文件选取对话框并接收用户的处理信息
if (i == fileChooser.APPROVE_OPTION) {// 用户选取了照片
File file = fileChooser.getSelectedFile();// 获得用户选取的文件对象
if (file != null) {
ImageIcon icon = new ImageIcon(file
.getAbsolutePath());// 创建照片对象
photoLabel.setText(null);// 取消提示文字
photoLabel.setIcon(icon);// 显示照片
}
}
}
}
});
final GridBagConstraints gridBagConstraints_8 = new GridBagConstraints();
gridBagConstraints_8.insets = new Insets(0, 0, 0, 0);
gridBagConstraints_8.gridheight = 5;
gridBagConstraints_8.gridy = 0;
gridBagConstraints_8.gridx = 9;
recordInfoPanel.add(photoLabel, gridBagConstraints_8);
final JLabel label_3 = new JLabel();
label_3.setText(" ");
final GridBagConstraints gridBagConstraints_94 = new GridBagConstraints();
gridBagConstraints_94.gridy = 0;
gridBagConstraints_94.gridx = 10;
recordInfoPanel.add(label_3, gridBagConstraints_94);
final JLabel nationLabel = new JLabel();
nationLabel.setText("民 族:");
final GridBagConstraints gridBagConstraints_4 = new GridBagConstraints();
gridBagConstraints_4.insets = new Insets(0, 0, 10, 0);
gridBagConstraints_4.gridy = 1;
gridBagConstraints_4.gridx = 0;
recordInfoPanel.add(nationLabel, gridBagConstraints_4);
nationComboBox = new JComboBox();
nationComboBox.addItem("请选择");
Iterator nationIt = dao.queryNation().iterator();
while (nationIt.hasNext()) {
TbNation nation = (TbNation) nationIt.next();
nationComboBox.addItem(nation.getName());
}
if (UPDATE_RECORD != null) {
String myNation = UPDATE_RECORD.getTbNation().getName();
nationComboBox.setSelectedItem(myNation);
}
final GridBagConstraints gridBagConstraints_5 = new GridBagConstraints();
gridBagConstraints_5.anchor = GridBagConstraints.WEST;
gridBagConstraints_5.insets = new Insets(0, 0, 10, 0);
gridBagConstraints_5.gridy = 1;
gridBagConstraints_5.gridx = 1;
recordInfoPanel.add(nationComboBox, gridBagConstraints_5);
final JLabel nativePlaceLabel = new JLabel();
nativePlaceLabel.setText("籍 贯:");
final GridBagConstraints gridBagConstraints_2 = new GridBagConstraints();
gridBagConstraints_2.insets = new Insets(0, 0, 10, 0);
gridBagConstraints_2.gridy = 1;
gridBagConstraints_2.gridx = 2;
recordInfoPanel.add(nativePlaceLabel, gridBagConstraints_2);
nativePlaceComboBox = new JComboBox();
nativePlaceComboBox.addItem("请选择");
Iterator nativePlaceIt = dao.queryNativePlace().iterator();
while (nativePlaceIt.hasNext()) {
TbNativePlace nativePlace = (TbNativePlace) nativePlaceIt.next();
nativePlaceComboBox.addItem(nativePlace.getName());
}
if (UPDATE_RECORD != null) {
String myNativePlace = UPDATE_RECORD.getTbNativePlace().getName();
nativePlaceComboBox.setSelectedItem(myNativePlace);
}
final GridBagConstraints gridBagConstraints_12 = new GridBagConstraints();
gridBagConstraints_12.anchor = GridBagConstraints.WEST;
gridBagConstraints_12.gridwidth = 2;
gridBagConstraints_12.insets = new Insets(0, 0, 10, 0);
gridBagConstraints_12.gridy = 1;
gridBagConstraints_12.gridx = 3;
recordInfoPanel.add(nativePlaceComboBox, gridBagConstraints_12);
final JLabel idCardLabel = new JLabel();
idCardLabel.setText("身份证号:");
final GridBagConstraints gridBagConstraints_15 = new GridBagConstraints();
gridBagConstraints_15.insets = new Insets(0, 0, 10, 0);
gridBagConstraints_15.gridy = 1;
gridBagConstraints_15.gridx = 5;
recordInfoPanel.add(idCardLabel, gridBagConstraints_15);
idCardTextField = new JTextField();
idCardTextField.setPreferredSize(new Dimension(125, 20));
if (UPDATE_RECORD != null)
idCardTextField.setText(UPDATE_RECORD.getIdCard());
final GridBagConstraints gridBagConstraints_16 = new GridBagConstraints();
gridBagConstraints_16.gridwidth = 2;
gridBagConstraints_16.insets = new Insets(0, 0, 10, 0);
gridBagConstraints_16.gridy = 1;
gridBagConstraints_16.gridx = 6;
recordInfoPanel.add(idCardTextField, gridBagConstraints_16);
final JLabel schoolageLabel = new JLabel();
schoolageLabel.setText("学 历:");
final GridBagConstraints gridBagConstraints_9 = new GridBagConstraints();
gridBagConstraints_9.insets = new Insets(0, 0, 10, 0);
gridBagConstraints_9.gridy = 2;
gridBagConstraints_9.gridx = 0;
recordInfoPanel.add(schoolageLabel, gridBagConstraints_9);
schoolageComboBox = new JComboBox();
schoolageComboBox.addItem("请选择");
schoolageComboBox.addItem("高中");
schoolageComboBox.addItem("大专");
schoolageComboBox.addItem("本科");
schoolageComboBox.addItem("硕士");
schoolageComboBox.addItem("博士");
if (UPDATE_RECORD != null)
schoolageComboBox.setSelectedItem(UPDATE_RECORD.getSchoolAge());
final GridBagConstraints gridBagConstraints_10 = new GridBagConstraints();
gridBagConstraints_10.anchor = GridBagConstraints.WEST;
gridBagConstraints_10.insets = new Insets(0, 0, 10, 0);
gridBagConstraints_10.gridy = 2;
gridBagConstraints_10.gridx = 1;
recordInfoPanel.add(schoolageComboBox, gridBagConstraints_10);
final JLabel specialtyLabel = new JLabel();
specialtyLabel.setText("专 业:");
final GridBagConstraints gridBagConstraints_19 = new GridBagConstraints();
gridBagConstraints_19.insets = new Insets(0, 0, 10, 0);
gridBagConstraints_19.gridy = 2;
gridBagConstraints_19.gridx = 2;
recordInfoPanel.add(specialtyLabel, gridBagConstraints_19);
specialtyTextField = new JTextField();
specialtyTextField.setPreferredSize(new Dimension(125, 20));
if (UPDATE_RECORD != null)
specialtyTextField.setText(UPDATE_RECORD.getSpecialty());
final GridBagConstraints gridBagConstraints_20 = new GridBagConstraints();
gridBagConstraints_20.gridwidth = 2;
gridBagConstraints_20.insets = new Insets(0, 0, 10, 20);
gridBagConstraints_20.gridy = 2;
gridBagConstraints_20.gridx = 3;
recordInfoPanel.add(specialtyTextField, gridBagConstraints_20);
final JLabel partyMemberLabel = new JLabel();
partyMemberLabel.setText("党 员:");
final GridBagConstraints gridBagConstraints_13 = new GridBagConstraints();
gridBagConstraints_13.insets = new Insets(0, 0, 10, 0);
gridBagConstraints_13.gridy = 2;
gridBagConstraints_13.gridx = 5;
recordInfoPanel.add(partyMemberLabel, gridBagConstraints_13);
//
final JRadioButton isPartyMemberRadioButton = new JRadioButton();
partyMemberButtonGroup.add(isPartyMemberRadioButton);
isPartyMemberRadioButton.setBackground(Color.WHITE);
isPartyMemberRadioButton.setText(" 是 ");
final GridBagConstraints gridBagConstraints_222 = new GridBagConstraints();
gridBagConstraints_222.insets = new Insets(0, 10, 10, 0);
gridBagConstraints_222.gridy = 2;
gridBagConstraints_222.gridx = 6;
recordInfoPanel.add(isPartyMemberRadioButton, gridBagConstraints_222);
final JRadioButton notPartyMemberRadioButton = new JRadioButton();
partyMemberButtonGroup.add(notPartyMemberRadioButton);
notPartyMemberRadioButton.setBackground(Color.WHITE);
notPartyMemberRadioButton.setSelected(true);
notPartyMemberRadioButton.setText(" 否 ");
final GridBagConstraints gridBagConstraints_961 = new GridBagConstraints();
gridBagConstraints_961.insets = new Insets(0, 0, 10, 0);
gridBagConstraints_961.gridy = 2;
gridBagConstraints_961.gridx = 7;
recordInfoPanel.add(notPartyMemberRadioButton, gridBagConstraints_961);
if (UPDATE_RECORD != null) {
if (UPDATE_RECORD.getPartyMember().equals("是"))
isPartyMemberRadioButton.setSelected(true);
else
notPartyMemberRadioButton.setSelected(true);
}
final JLabel foreignLanguageLabel = new JLabel();
foreignLanguageLabel.setText("外语语种:");
final GridBagConstraints gridBagConstraints_17 = new GridBagConstraints();
gridBagConstraints_17.insets = new Insets(0, 0, 10, 0);
gridBagConstraints_17.gridy = 3;
gridBagConstraints_17.gridx = 0;
recordInfoPanel.add(foreignLanguageLabel, gridBagConstraints_17);
foreignLanguageTextField = new JTextField();
foreignLanguageTextField.setPreferredSize(new Dimension(125, 20));
if (UPDATE_RECORD != null)
foreignLanguageTextField
.setText(UPDATE_RECORD.getForeignLanguage());
final GridBagConstraints gridBagConstraints_18 = new GridBagConstraints();
gridBagConstraints_18.insets = new Insets(0, 0, 10, 20);
gridBagConstraints_18.gridy = 3;
gridBagConstraints_18.gridx = 1;
recordInfoPanel.add(foreignLanguageTextField, gridBagConstraints_18);
final JLabel gradeLabel = new JLabel();
gradeLabel.setText("外语水平:");
final GridBagConstraints gridBagConstraints_23 = new GridBagConstraints();
gridBagConstraints_23.insets = new Insets(0, 0, 10, 0);
gridBagConstraints_23.gridy = 3;
gridBagConstraints_23.gridx = 2;
recordInfoPanel.add(gradeLabel, gridBagConstraints_23);
gradeTextField = new JTextField();
gradeTextField.setPreferredSize(new Dimension(125, 20));
if (UPDATE_RECORD != null)
gradeTextField.setText(UPDATE_RECORD.getGrade());
final GridBagConstraints gridBagConstraints_24 = new GridBagConstraints();
gridBagConstraints_24.gridwidth = 2;
gridBagConstraints_24.insets = new Insets(0, 0, 10, 20);
gridBagConstraints_24.gridy = 3;
gridBagConstraints_24.gridx = 3;
recordInfoPanel.add(gradeTextField, gridBagConstraints_24);
final JLabel marriagedLabel = new JLabel();
marriagedLabel.setText("婚姻状况:");
final GridBagConstraints gridBagConstraints_21 = new GridBagConstraints();
gridBagConstraints_21.insets = new Insets(0, 0, 10, 0);
gridBagConstraints_21.gridy = 3;
gridBagConstraints_21.gridx = 5;
recordInfoPanel.add(marriagedLabel, gridBagConstraints_21);
final JRadioButton notMarriagedRadioButton = new JRadioButton();
marriagedButtonGroup.add(notMarriagedRadioButton);
notMarriagedRadioButton.setBackground(Color.WHITE);
notMarriagedRadioButton.setText("未婚");
final GridBagConstraints gridBagConstraints_22 = new GridBagConstraints();
gridBagConstraints_22.insets = new Insets(0, 10, 10, 0);
gridBagConstraints_22.gridy = 3;
gridBagConstraints_22.gridx = 6;
recordInfoPanel.add(notMarriagedRadioButton, gridBagConstraints_22);
final JRadioButton hasMarriagedRadioButton = new JRadioButton();
marriagedButtonGroup.add(hasMarriagedRadioButton);
hasMarriagedRadioButton.setBackground(Color.WHITE);
hasMarriagedRadioButton.setText("已婚");
final GridBagConstraints gridBagConstraints_96 = new GridBagConstraints();
gridBagConstraints_96.insets = new Insets(0, 0, 10, 0);
gridBagConstraints_96.gridy = 3;
gridBagConstraints_96.gridx = 7;
recordInfoPanel.add(hasMarriagedRadioButton, gridBagConstraints_96);
if (UPDATE_RECORD != null) {
if (UPDATE_RECORD.getMarriaged().equals("未婚"))
notMarriagedRadioButton.setSelected(true);
else
hasMarriagedRadioButton.setSelected(true);
}
final JLabel postalcodeLabel = new JLabel();
postalcodeLabel.setText("邮政编码:");
final GridBagConstraints gridBagConstraints_25 = new GridBagConstraints();
gridBagConstraints_25.insets = new Insets(0, 0, 5, 0);
gridBagConstraints_25.gridy = 4;
gridBagConstraints_25.gridx = 0;
recordInfoPanel.add(postalcodeLabel, gridBagConstraints_25);
postalcodeTextField = new JTextField();
postalcodeTextField.setPreferredSize(new Dimension(125, 20));
if (UPDATE_RECORD != null)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -