团队的作业:学生信息管理系统
- 队员学号:
周菲(队长) 201810812007
孔繁燕 201810812001
Alpha敏捷冲刺:
1、 站立式会议照片:
2、每个人的工作:
周菲:
今天已完成: 用户非法信息录入输入提示框设计和实现
遇到的问题: 暂无
明天计划完成: 用户非法信息录入输入提示框功能测试
孔繁燕:
今天已完成:用户非法信息录入输入提示框设计和实现
遇到的问题:暂无
明天计划完成:用户非法信息录入输入提示框功能测试
3、项目燃尽图
4、部分项目代码和截图:
package ui.internal.students; import java.awt.Font; import java.util.Vector; import javax.swing.DefaultComboBoxModel; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JTextField; import entity.Grade; import entity.Student; import service.GradeService; import service.StudentService; import util.IReload; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.ImageIcon; import java.awt.Color; public class StudentAddDialog extends JInternalFrame { private static final long serialVersionUID = 1L; private JTextField txtId; private JTextField txtName; private JTextField txtAge; private JTextField txtPhone; private JComboBox<Grade> comboBox; private JComboBox comboBox_1; private GradeService gradeService = new GradeService(); private StudentService studentService = new StudentService(); private IReload reload = null; public StudentAddDialog(String title,IReload reload) { super(title); this.reload=reload; init(); } public StudentAddDialog() { setTitle("增加一条学生信息..."); getContentPane().setBackground(new Color(176, 224, 230)); getContentPane().setForeground(new Color(240, 248, 255)); setForeground(new Color(173, 216, 230)); setIconifiable(true); setFrameIcon(new ImageIcon(StudentAddDialog.class.getResource("/image/change.png"))); init(); } private void init() { setClosable(true); setBounds(100, 100, 411, 387); getContentPane().setLayout(null); JLabel label = new JLabel("学号:"); label.setForeground(Color.GRAY); label.setFont(new Font("微软雅黑", Font.ITALIC, 14)); label.setBounds(33, 10, 75, 36); getContentPane().add(label); txtId = new JTextField(); txtId.setBounds(105, 19, 206, 21); getContentPane().add(txtId); txtId.setColumns(10); JLabel label_1 = new JLabel("姓名:"); label_1.setForeground(Color.GRAY); label_1.setFont(new Font("微软雅黑", Font.ITALIC, 14)); label_1.setBounds(33, 56, 101, 36); getContentPane().add(label_1); txtName = new JTextField(); txtName.setColumns(10); txtName.setBounds(105, 65, 206, 21); getContentPane().add(txtName); JLabel label_2 = new JLabel("年龄:"); label_2.setForeground(new Color(128, 128, 128)); label_2.setFont(new Font("微软雅黑", Font.ITALIC, 14)); label_2.setBounds(33, 102, 101, 36); getContentPane().add(label_2); txtAge = new JTextField(); txtAge.setColumns(10); txtAge.setBounds(105, 111, 206, 21); getContentPane().add(txtAge); JLabel label_3 = new JLabel("班级:"); label_3.setForeground(Color.GRAY); label_3.setFont(new Font("微软雅黑", Font.ITALIC, 14)); label_3.setBounds(33, 148, 101, 36); getContentPane().add(label_3); comboBox = new JComboBox<Grade>(); comboBox.setBackground(new Color(255, 255, 255)); comboBox.setForeground(Color.DARK_GRAY); comboBox.setFont(new Font("微软雅黑", Font.PLAIN, 12)); comboBox.setBounds(105, 157, 206, 21); getContentPane().add(comboBox); String []str= {"男","女"}; comboBox_1 = new JComboBox(str); comboBox_1.setBounds(105, 203, 206, 21); getContentPane().add(comboBox_1); txtPhone = new JTextField(); txtPhone.setColumns(10); txtPhone.setBounds(105, 250, 206, 21); getContentPane().add(txtPhone); JLabel label_4 = new JLabel("手机号:"); label_4.setForeground(Color.GRAY); label_4.setFont(new Font("微软雅黑", Font.ITALIC, 14)); label_4.setBounds(33, 241, 101, 36); getContentPane().add(label_4); JLabel label_5 = new JLabel("性別:"); label_5.setForeground(Color.GRAY); label_5.setFont(new Font("微软雅黑", Font.ITALIC, 14)); label_5.setBounds(33, 194, 101, 36); getContentPane().add(label_5); JButton btnSave = new JButton("保存"); btnSave.setBackground(new Color(255, 255, 255)); btnSave.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int id = Integer.parseInt(txtId.getText()); if(!(id>=2018001&&id<=2018100)) { JOptionPane.showMessageDialog(getContentPane(), "学号输入不正确 正确输入范围为:2018001~2018100"); return; } String name = txtName.getText(); int age = Integer.parseInt(txtAge.getText()); Grade g = (Grade)(comboBox.getSelectedItem()); int gradeId = g.getGradeId(); String phone = txtPhone.getText(); String sex = comboBox_1.getSelectedItem().toString(); Student stu = new Student(id,name,age,gradeId,phone,sex); boolean isSave = studentService.add(stu); if(isSave){ reload.reload(); StudentAddDialog.this.dispose(); }else{ System.out.println("保存失败"); } } }); btnSave.setBounds(33, 299, 93, 23); getContentPane().add(btnSave); JButton btnCancel = new JButton("取消"); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { StudentAddDialog.this.dispose(); } }); btnCancel.setBounds(218, 299, 93, 23); getContentPane().add(btnCancel); loadAllGrades(); } private void loadAllGrades() { Vector<Grade> grades = new Vector<>(gradeService.getAllGrades()); comboBox.setModel(new DefaultComboBoxModel<Grade>(grades)); } }