📄 studentinfopanel.java
字号:
/**
* This method initializes jTMotherPhone
*
* @return javax.swing.JTextField
*/
private JTextField getJTMotherPhone() {
if (jTMotherPhone == null) {
jTMotherPhone = new JTextField();
jTMotherPhone.setBounds(new Rectangle(330, 136, 165, 18));
jTMotherPhone.setEnabled(false);
}
return jTMotherPhone;
}
/**
* This method initializes jBFirst
*
* @return javax.swing.JButton
*/
private JButton getJBFirst() {
if (jBFirst == null) {
jBFirst = new JButton();
jBFirst.setBounds(new Rectangle(25, 251, 50, 22));
jBFirst.setText("<");
jBFirst.setActionCommand("<");
jBFirst.addActionListener(this);
}
return jBFirst;
}
/**
* This method initializes jBBackUp
*
* @return javax.swing.JButton
*/
private JButton getJBBackUp() {
if (jBBackUp == null) {
jBBackUp = new JButton();
jBBackUp.setBounds(new Rectangle(74, 251, 50, 22));
jBBackUp.setText("<<");
jBBackUp.setActionCommand("<<");
jBBackUp.addActionListener(this);
}
return jBBackUp;
}
/**
* This method initializes jBNext
*
* @return javax.swing.JButton
*/
private JButton getJBNext() {
if (jBNext == null) {
jBNext = new JButton();
jBNext.setBounds(new Rectangle(123, 251, 50, 22));
jBNext.setText(">>");
jBNext.setActionCommand(">>");
jBNext.addActionListener(this);
}
return jBNext;
}
/**
* This method initializes jBLast
*
* @return javax.swing.JButton
*/
private JButton getJBLast() {
if (jBLast == null) {
jBLast = new JButton();
jBLast.setBounds(new Rectangle(172, 251, 50, 22));
jBLast.setText(">");
jBLast.setActionCommand(">");
jBLast.addActionListener(this);
}
return jBLast;
}
/**
* This method initializes jBNew
*
* @return javax.swing.JButton
*/
private JButton getJBNew() {
if (jBNew == null) {
jBNew = new JButton();
jBNew.setBounds(new Rectangle(25, 286, 60, 22));
jBNew.setText("添加");
jBNew.setActionCommand("new");
jBNew.addActionListener(this);
}
return jBNew;
}
/**
* This method initializes jBModify
*
* @return javax.swing.JButton
*/
private JButton getJBModify() {
if (jBModify == null) {
jBModify = new JButton();
jBModify.setBounds(new Rectangle(88, 286, 65, 22));
jBModify.setText("修改");
jBModify.setActionCommand("modify");
jBModify.addActionListener(this);
}
return jBModify;
}
/**
* This method initializes jBDelete
*
* @return javax.swing.JButton
*/
private JButton getJBDelete() {
if (jBDelete == null) {
jBDelete = new JButton();
jBDelete.setBounds(new Rectangle(156, 286, 64, 22));
jBDelete.setText("删除");
jBDelete.setActionCommand("delete");
jBDelete.addActionListener(this);
}
return jBDelete;
}
/**
* This method initializes jBChengJi
*
* @return javax.swing.JButton
*/
private JButton getJBChengJi() {
if (jBChengJi == null) {
jBChengJi = new JButton();
jBChengJi.setBounds(new Rectangle(24, 313, 197, 37));
jBChengJi.setText("管理该学员成绩");
jBChengJi.setActionCommand(this.CHENG_JI_MANAGE);
jBChengJi.addActionListener(this);
}
return jBChengJi;
}
/**
* This method initializes jPChengJi
*
* @return javax.swing.JPanel
*/
private JPanel getJPChengJi() {
if (jPChengJi == null) {
jLRemark = new JLabel();
jLRemark.setText("备注:");
jLRemark.setBounds(new Rectangle(130, 189, 57, 18));
jLchengJi = new JLabel();
jLchengJi.setText("成绩:");
jLchengJi.setBounds(new Rectangle(6, 189, 52, 18));
jLKeChengName = new JLabel();
jLKeChengName.setText("课程号:");
jLKeChengName.setBounds(new Rectangle(129, 154, 60, 18));
jLKeChengHao = new JLabel();
jLKeChengHao.setText("课程名称:");
jLKeChengHao.setBounds(new Rectangle(2, 154, 60, 18));
jPChengJi = new JPanel();
jPChengJi.setLayout(null);
jPChengJi.setBounds(new Rectangle(240, 196, 262, 223));
jPChengJi.setVisible(true);
jPChengJi.add(getJScrollPane(), null);
jPChengJi.add(getJBNewChengJi(), null);
jPChengJi.add(getJBModifyChengJi(), null);
jPChengJi.add(getJBDeleteChengJi(), null);
jPChengJi.add(jLKeChengHao, null);
jPChengJi.add(jLKeChengName, null);
jPChengJi.add(jLchengJi, null);
jPChengJi.add(jLRemark, null);
jPChengJi.add(getJTChengJi(), null);
jPChengJi.add(getJTKeChengNum(), null);
jPChengJi.add(getJTRemark(), null);
jPChengJi.add(getJCKeChengName(), null);
}
return jPChengJi;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setBounds(new Rectangle(1, 8, 259, 95));
jScrollPane.setViewportView(getJTable());
}
return jScrollPane;
}
/**
* This method initializes jTable
*
* @return javax.swing.JTable
*/
private JTable getJTable() {
if (jTable == null) {
jTable = new JTable();
jTable.setSelectionBackground(Color.yellow);
jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jTable.getSelectionModel().addListSelectionListener(this);
}
return jTable;
}
/**
* This method initializes jBNewChengJi
*
* @return javax.swing.JButton
*/
private JButton getJBNewChengJi() {
if (jBNewChengJi == null) {
jBNewChengJi = new JButton();
jBNewChengJi.setText("添加成绩");
jBNewChengJi.setBounds(new Rectangle(1, 113, 86, 22));
jBNewChengJi.setActionCommand(this.NEW_CJ);
jBNewChengJi.addActionListener(this);
}
return jBNewChengJi;
}
/**
* This method initializes jBModifyChengJi
*
* @return javax.swing.JButton
*/
private JButton getJBModifyChengJi() {
if (jBModifyChengJi == null) {
jBModifyChengJi = new JButton();
jBModifyChengJi.setText("修改成绩");
jBModifyChengJi.setBounds(new Rectangle(86, 113, 86, 22));
jBModifyChengJi.setActionCommand(MODIFY_CJ);
jBModifyChengJi.addActionListener(this);
}
return jBModifyChengJi;
}
/**
* This method initializes jBDeleteChengJi
*
* @return javax.swing.JButton
*/
private JButton getJBDeleteChengJi() {
if (jBDeleteChengJi == null) {
jBDeleteChengJi = new JButton();
jBDeleteChengJi.setText("删除成绩");
jBDeleteChengJi.setBounds(new Rectangle(171, 113, 86, 22));
jBDeleteChengJi.setActionCommand(DELETE_CJ);
jBDeleteChengJi.addActionListener(this);
}
return jBDeleteChengJi;
}
/**
* This method initializes jTChengJi
*
* @return javax.swing.JTextField
*/
private JTextField getJTChengJi() {
if (jTChengJi == null) {
jTChengJi = new JTextField();
jTChengJi.setBounds(new Rectangle(64, 189, 60, 18));
}
return jTChengJi;
}
/**
* This method initializes jTKeChengNum
*
* @return javax.swing.JTextField
*/
private JTextField getJTKeChengNum() {
if (jTKeChengNum == null) {
jTKeChengNum = new JTextField();
jTKeChengNum.setBounds(new Rectangle(192, 154, 67, 18));
jTKeChengNum.setEnabled(false);
}
return jTKeChengNum;
}
/**
* This method initializes jTRemark
*
* @return javax.swing.JTextField
*/
private JTextField getJTRemark() {
if (jTRemark == null) {
jTRemark = new JTextField();
jTRemark.setBounds(new Rectangle(192, 189, 67, 18));
}
return jTRemark;
}
/**
* This method initializes jTJiGuan
*
* @return javax.swing.JTextField
*/
private JTextField getJTJiGuan() {
if (jTJiGuan == null) {
jTJiGuan = new JTextField();
jTJiGuan.setBounds(new Rectangle(106, 225, 120, 18));
jTJiGuan.setEnabled(false);
}
return jTJiGuan;
}
/**
* 初始话所有的组件内容
*
*/
private void initComponents() {
this.count = 0;
list = this.otherUtil.getStudentInfos();
if (list != null && list.size() > 0) {
stuInfo = list.get(0);
initStudentInfoText(stuInfo);
}
initButton(list);
this.initJTable(this.stuInfo);
this.initKeChengCommboxItem();
}
// private void initJTable() {
//
// String[] column = { "课程名称", "课程号", "成绩", "备注"};
//
// List<KeMuChengJi> list = this.otherUtil.getKeMuChengJis(this.stuInfo);
// Object[][] object = new Object[list.size()][column.length];
// for (int i = 0; i < list.size(); i++) {
// this.keMuChengJi = list.get(i);
// object[i][0] = keMuChengJi.getCi().getName();
// object[i][1] = keMuChengJi.getCi().getNumber();
// object[i][2] = keMuChengJi.getChengJi();
// object[i][2] = keMuChengJi.getRemark();
// }
//
// this.getJTable().setModel(new DefaultTableModel(object, column));
// this.getJScrollPane().setVisible(false);
// this.getJScrollPane().setVisible(true);
// }
/**
* 根据学生信息,设置对应的文本框值
*
* @param stuInfo
*/
private void initStudentInfoText(StudentInfo stuInfo) {
this.enableJText(false);
if (stuInfo != null) {
this.getJTName().setText(stuInfo.getName());
this.getJTNumber().setText(stuInfo.getNumber());
if (stuInfo.getSex().trim().equals("男")) {
this.getJCSex().setSelectedIndex(0);
} else {
this.getJCSex().setSelectedIndex(1);
}
this.getJTMingZhu().setText(stuInfo.getPhyle());
if (stuInfo.getBirthday() != null) {
this.getJTBirthday().setText(
DateUtil.formatYYYYMMDD(stuInfo.getBirthday()));
} else {
this.getJTBirthday().setText("");
}
this.getJTAddress().setText(stuInfo.getAddres());
this.getJTFatherName().setText(stuInfo.getFatherName());
this.getJTMotherName().setText(stuInfo.getMotherName());
this.getJTFatherPhone().setText(stuInfo.getFatherPhone());
this.getJTMotherPhone().setText(stuInfo.getMotherPhone());
this.getJTZip().setText(stuInfo.getZip());
// this.getJTBanJi().setText(stuInfo.getClassInfo().getName());
this.getJTJiGuan().setText(stuInfo.getNativePlace());
this.getJTZhuangYe().setText(stuInfo.getZhuangYe());
this.getJTBanJi().setText(stuInfo.getClassName());
} else {
setJTextNullValue();
}
}
/**
* 初始学生基本信息文本字段都为空
*
*/
private void setJTextNullValue() {
this.getJTName().setText("");
this.getJTNumber().setText("");
this.getJCSex().setSelectedIndex(0);
this.getJTMingZhu().setText("");
this.getJTBirthday().setText(DateUtil.formatYYYYMMDD(new Date()));
this.getJTAddress().setText("");
this.getJTFatherName().setText("");
this.getJTMotherName().setText("");
this.getJTFatherPhone().setText("");
this.getJTMotherPhone().setText("");
this.getJTZip().setText("");
this.getJTJiGuan().setText("");
this.getJTZhuangYe().setText("");
this.getJTBanJi().setText("");
this.setVisible(false);
this.setVisible(true);
}
private void initButton(List<StudentInfo> list) {
if (list == null || list.size() == 0) {
enableBrowButton(false);
} else if (list.size() == 1) {
this.getJBFirst().setEnabled(true);
this.getJBBackUp().setEnabled(false);
this.getJBNext().setEnabled(false);
this.getJBLast().setEnabled(false);
} else {
enableBrowButton(true);
}
}
/**
* 设置数据浏览按钮的使能状态
*
* @param value
*/
private void enableBrowButton(boolean value) {
this.getJBBackUp().setEnabled(value);
this.getJBNext().setEnabled(value);
this.getJBLast().setEnabled(value);
this.getJBFirst().setEnabled(value);
}
private void enableJText(boolean value) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -