java课程设计小组分工_java课程设计---团体
課設題目:學生信息管理系統
一、團隊成員介紹
周漢麟(組長):網絡1511 201521123030
吳敏烽(組員):網絡1512 201521123044
二、項目git地址
三、碼云提交記錄
四、項目功能架構圖與主要功能流程圖
項目主要功能流程圖
五、項目運行截圖
六、項目關鍵代碼(不能太多)
//學生信息管理系統登錄界面
public boolean equals(){
if("admin".equals(name)&&"admin".equals(password)){
return true;
}else{
return false;
}
}
};
class ActionHandle{
private JFrame frame=new JFrame("學生信息管理系統");
private JTextField name=new JTextField();//設置文本框
private JPasswordField pass=new JPasswordField();
private JLabel but1=new JLabel("用戶名:");
private JLabel but2=new JLabel("密 碼:");
private JButton but3=new JButton("登陸");
private JButton but4=new JButton("重置");
public ActionHandle(){
but3.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if(e.getSource()==but3){
String sname=name.getText();
String spass=new String(pass.getPassword());
LoginCheck log=new LoginCheck(sname,spass);
if(log.equals()){
try {
new Menu();
} catch (Exception e1) {
e1.printStackTrace();
}
frame.setVisible(false);
}else{
JOptionPane.showMessageDialog(null, "登錄失敗,錯誤的用戶名或密碼!");
}
}
}
});
//框架設置:
frame.setLayout(null);
but1.setBounds(80, 40 , 80,30);
name.setBounds(140,40, 120, 30);//
but2.setBounds(80, 80 , 80,30);
pass.setBounds(140,80, 120, 30);
but3.setBounds(100, 150 , 60,30);
but4.setBounds(180, 150 , 60,30);
frame.setSize(400,330);
frame.setLocation(300, 200);
frame.add(but1);
frame.add(name);
frame.add(pass);
frame.add(but2);
frame.add(but3);
frame.add(but4);
frame.setVisible(true);
}
}
public class Enter{
public static void main(String[] args) {
new ActionHandle();
}
}
//添加信息:(修改信息和這個類似)
but1.addActionListener(new ActionListener() { // 增加,內部類
public void actionPerformed(ActionEvent e) {
if (e.getSource() == but1) {
but3.setEnabled(false);//使but3這個按鈕變灰不可點擊了
String number1 = number.getText();
if (number1.length() == 12) {
try {
ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));//讀回對象
has = (Hashtable) in.readObject(); in.close();
} catch (Exception e1) {
}
} else {
JOptionPane.showMessageDialog(null, "請輸入12位數字的學號");
}
//
if (number1.length() == 12) {
if (has.containsKey(number1)) {JOptionPane.showMessageDialog(null, "該生信息已存在,請到修改頁面修改!");
} else {
String name1 = name.getText();
String dor1 = dor.getText();
String address1 = address.getText();
String sex1 = sex.getText();
String date1 = date.getText();
String pol1 = pol.getText();
String phone1 = phone.getText();
Person per = null;
per = new Person(number1, name1, dor1, address1, sex1, date1, pol1, phone1);
has.put(number1, per);// ???
try {
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file));
out.writeObject(has);
out.close();
JOptionPane.showMessageDialog(null, "添加成功!");
} catch (Exception e1) {}
}
}
}
}
});
//文件的保存和顯示:
but4.addActionListener(new ActionListener() { // 查看
public void actionPerformed(ActionEvent e) {
if (e.getSource() == but4) {
but3.setEnabled(false);
String number1 = number.getText();
if (number1.length() == 12) {
if (has.containsKey(number1)) {
try {
ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
has = (Hashtable) in.readObject();
in.close();
} catch (Exception e1) {
}
Person per = (Person) has.get(number1);
name.setText(per.getName());
dor.setText(per.getDor());
address.setText(per.getAddress());
sex.setText(per.getSex());
date.setText(per.getDate());
pol.setText(per.getPol());
phone.setText(per.getPhone());
but3.setEnabled(true);
} else {
JOptionPane.showMessageDialog(null, "學號不存在");
}
} else {
JOptionPane.showMessageDialog(null, "請輸入12位數字的學號");
}
}
}
});
but5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == but5) {
frame1.setVisible(true);
try {
ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
has = (Hashtable) in.readObject();
in.close();
} catch (Exception ee) {
}
if (has.isEmpty()) {
show.append("目前還沒有學生的信息記錄!\n");
// append(s:String)向文本域的文本追加字符串,簡單的說就像system.out.println()
} else {
for (Enumeration enu = has.elements(); enu.hasMoreElements();) {
//存入內存的內容如果不經過遍歷是顯示不出來的
Person per = (Person) enu.nextElement();
String str = " :" + per.getNum() + "\n" + " :" + per.getName() + "\n" + " :"
+ per.getDor() + "\n" + " :" + per.getAddress() + "\n" + " :"
+ per.getSex() + "\n" + ":" + per.getDate() + "\n" + " :"
+ per.getPol() + "\n" + " :" + per.getPhone() + "\n" + "\n";
show.append(str);
}
String str2 = "------------------------------結束---------------------------------------------------"
+ "\n";
show.append(str2);
}
}
}
});
but0.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == but0) {
frame.setVisible(false);
new ActionHandle();
}
}
});
七、尚待改進或者新的想法
1.功能比較齊全,增刪改查都有,雖然GUI設計得比較簡陋。
2.需要完善添加統計學生各門科目成績,班級平均分等。
八、團隊成員任務分配,團隊成員課程設計博客鏈接(以表格形式呈現),標明組長。
總結
以上是生活随笔為你收集整理的java课程设计小组分工_java课程设计---团体的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Excel之数据透视表
- 下一篇: [css] 如何使用CSS3的属性设置