最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

java實(shí)現(xiàn)學(xué)生成績(jī)信息管理系統(tǒng)

 更新時(shí)間:2020年07月27日 10:51:24   作者:xxcharles98  
這篇文章主要為大家詳細(xì)介紹了java實(shí)現(xiàn)學(xué)生成績(jī)信息管理系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

JAVA大作業(yè):學(xué)生成績(jī)管理系統(tǒng)(含有用戶界面),供大家參考,具體內(nèi)容如下

ps :多個(gè)包寫在一起

package test;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.ArrayList;

class person{
 public String name;
 public String age;
}

class Student extends person{
 public String no;
 public String score1,score2,score3,score4;
 public Student(String no, String name, String age,String score1,String score2,String score3,String score4) {
 this.no = no;
 this.name = name;
 this.age = age;
 this.score1 = score1; 
 this.score2 = score2; 
 this.score3 = score3;
 this.score4 = score4; 
 }

 public String getNo() {
 return this.no;
 }
 public void setNo(String no) {
 this.no = no;
 }
 public String getName() {
 return this.name;
 }
 public void setName(String name) {
 this.name = name;
 }
 public String getAge() {
 return this.age;
 }
 public void setAge(String age) {
 this.age = age;
 }
 public String getscore1() {
 return this.score1;
 }
 public void setscore1(String score1) {
 this.score1 = score1;
 }
 public String getscore2() {
  return this.score2;
 }
 public void setscore2(String score2) {
  this.score2 = score2;
 }
 public String getscore3() {
 return this.score3;
 }
 public void setscore3(String score3) {
 this.score3 = score3;
 }
 public String getscore4() {
 return this.score4;
 }
 public void setscore4(String score4) {
 this.score4 = score4;
 }

}

class Class{
 ArrayList<Student> stuList;
 public Class(){
 this.stuList=new ArrayList<>();
 }
 public void addStudent(Student stu){
 this.stuList.add(stu);
 }
 public void deleteStudent(Student s){
 this.stuList.remove(s);
 }
}

class menu extends JFrame{
 public menu()
 { 
 this.setBounds(300, 150, 500, 450);
 this.setTitle("大連海事大學(xué) -- --學(xué)生信息管理系統(tǒng)");
 this.setLayout(null);
 JLabel labTipw = new JLabel("歡迎進(jìn)入 大連海事大學(xué) 學(xué)生信息管理系統(tǒng)");
 labTipw.setBounds(50, 2, 250, 45);
 JLabel labTipws = new JLabel("(*新用戶初始密碼為 身份證后六位數(shù)字)");
 labTipws.setBounds(50, 15, 250, 45);
 JLabel labyonghu = new JLabel("用戶名:");
 labyonghu.setBounds(50, 60, 100, 50);
 JTextField txtyonghu = new JTextField("請(qǐng)輸入登錄用戶名:",30);
 txtyonghu.setBounds(130, 76, 180, 30); 
 JLabel labmima = new JLabel("密碼:");
 labmima.setBounds(50, 100, 50, 50);
 JTextField txtmima = new JTextField("請(qǐng)輸入登錄6位密碼:",30);
 txtmima.setBounds(130, 117, 180, 30);
 JButton btndianji = new JButton("點(diǎn)擊登錄"); 
 btndianji.setBounds(130, 165, 180, 30);
 btndianji.setForeground(Color.BLUE);

 this.add(labTipw);
 this.add(labTipws);
 this.add(labyonghu);
 this.add(txtyonghu);
 this.add(labmima);
 this.add(txtmima);
 this.add(btndianji);
 btndianji.addActionListener(new ActionListener() {
 public void actionPerformed(ActionEvent e) {
 new StudentFrame();}
 } );
 setVisible(true);
 } 
}

public class StudentFrame extends JFrame {
 Class c = new Class();
 JLabel labNo;
 JLabel labName;
 JLabel labAge;
 JLabel labscore1;
 JLabel labscore2;
 JLabel labscore3;
 JLabel labscore4;
 JLabel labTip;
 JLabel labavr;

 JTextField txtNo;
 JTextField txtName;
 JTextField txtAge;
 JTextField txtscore1;
 JTextField txtscore2;
 JTextField txtscore3;
 JTextField txtscore4;
 JTextField txtavr;

 JButton btnAdd;
 JButton btnRemove;
 JButton btnModify;
 JButton btnClear;
 JButton btnFirst;
 JButton btnPrev;
 JButton btnNext;
 JButton btnLast;
 JButton btnCheck;
 JOptionPane dialog;

 public StudentFrame() {
  this.setBounds(300, 100, 650, 530);
  this.setTitle("大連海事大學(xué) -- --學(xué)生信息管理系統(tǒng)");
  this.setLayout(null);
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  studentin(); 
  addStu();
  firstStudent();
  lastStudent();
  previous();
  next();
  remove();
  check();
  modify();
  clear();
  this.setVisible(true); 
 }

 public void studentin() {
  labTip = new JLabel("登陸成功 !您已經(jīng)進(jìn)入管理系統(tǒng)(僅輸入學(xué)號(hào)便可查找學(xué)生信息).");
  labTip.setBounds(50, 2, 550, 45); 
  labNo = new JLabel("學(xué)生學(xué)號(hào):");  
  labNo.setBounds(50, 20, 100, 50);
  txtNo = new JTextField("請(qǐng)輸入6位學(xué)號(hào):",30);
  txtNo.setBounds(130, 35, 180, 30);  
  labName = new JLabel("學(xué)生姓名:");
  labName.setBounds(50, 60, 100, 50);
  txtName = new JTextField("請(qǐng)輸入學(xué)生姓名:",30);
  txtName.setBounds(130, 76, 180, 30); 
  labAge = new JLabel("班級(jí):");
  labAge.setBounds(50, 100, 50, 50);
  txtAge = new JTextField("請(qǐng)輸入學(xué)生所在班級(jí):",30);
  txtAge.setBounds(130, 117, 180, 30);
  labscore1 = new JLabel("JAVA 成績(jī):");  
  labscore1.setBounds(50, 140, 100, 50);
  txtscore1 = new JTextField("請(qǐng)輸入學(xué)生成績(jī):",30);
  txtscore1.setBounds(130, 158, 180, 30);
  labscore2 = new JLabel("C語(yǔ)言成績(jī):");  
  labscore2.setBounds(50, 189, 100, 50);
  txtscore2 = new JTextField("請(qǐng)輸入學(xué)生成績(jī):",30);
  txtscore2.setBounds(130, 199, 180, 30);
  labscore3 = new JLabel("Python成績(jī):");  
  labscore3.setBounds(50, 230, 100, 50);
  txtscore3 = new JTextField("請(qǐng)輸入學(xué)生成績(jī):",30);
  txtscore3.setBounds(130, 240, 180, 30);
  labscore4 = new JLabel("C++ 成績(jī):");  
  labscore4.setBounds(50, 290, 100, 50);
  txtscore4 = new JTextField("請(qǐng)輸入學(xué)生成績(jī):",30);
  txtscore4.setBounds(130, 301, 180, 30);
  labavr = new JLabel("操作說(shuō)明 ** |<< : 第一個(gè)學(xué)生信息 <:上一位學(xué)生信息 >:下一個(gè)學(xué)生信息 >>|:最后一個(gè)學(xué)生信息");
  labavr.setBounds(50, 330, 580, 50);

  btnAdd = new JButton("添加");
  btnAdd.setBounds(50, 385, 80, 20);
  btnAdd.setForeground(Color.BLACK);
  btnModify = new JButton("修改");
  btnModify.setBounds(150, 385, 80, 20);
  btnModify.setForeground(Color.BLUE);
  btnRemove = new JButton("刪除");
  btnRemove.setBounds(250, 385, 80, 20);
  btnRemove.setForeground(Color.RED);
  btnClear = new JButton("清空");
  btnClear.setBounds(350, 385, 80, 20);
  btnClear.setForeground(Color.GREEN);
  btnCheck = new JButton("查找信息");
  btnCheck.setBounds(350, 145, 160, 50);
  btnCheck.setForeground(Color.BLACK);
  btnFirst = new JButton("|<<");
  btnFirst.setBounds(50, 432, 80, 20);
  btnFirst.setForeground(Color.PINK);
  btnPrev = new JButton("<");
  btnPrev.setBounds(150, 432, 80, 20);
  btnPrev.setForeground(Color.BLACK);
  btnNext = new JButton(">");
  btnNext.setBounds(250, 432, 80, 20);
  btnNext.setForeground(Color.BLACK);
  btnLast = new JButton(">>|");
  btnLast.setBounds(350, 432, 80, 20);
  btnLast.setForeground(Color.PINK);

  this.add(labNo);
  this.add(labName);
  this.add(labAge);
  this.add(labscore1);
  this.add(txtNo);
  this.add(labTip);
  this.add(txtName);
  this.add(txtAge);
  this.add(txtscore1);
  this.add(btnAdd);
  this.add(btnRemove);
  this.add(btnModify);
  this.add(btnClear);
  this.add(btnFirst);
  this.add(btnPrev);
  this.add(btnNext);
  this.add(btnLast);
  this.add(btnCheck);
  this.add(labavr);
  this.add(labscore2);
  this.add(txtscore2);
  this.add(labscore3);
  this.add(txtscore3); 
  this.add(labscore4);
  this.add(txtscore4);


 }

 public boolean blank() {
  if (txtNo.getText().equals("")) {
  dialog.showMessageDialog(null, "學(xué)號(hào)輸入有誤 請(qǐng)重新輸入!");
  return false;
  }
  if (txtName.getText().equals("")) {
  dialog.showMessageDialog(null, "名字輸入有誤 請(qǐng)重新輸入!");
  return false;
  }
  if (txtAge.getText().equals("")) {
  dialog.showMessageDialog(null, "班級(jí)輸入有誤 請(qǐng)重新輸入!");
  return false;
  }if (txtscore1.getText().equals("")) {
  dialog.showMessageDialog(null, "成績(jī)輸入有誤 請(qǐng)重新輸入!");
  return false;
  }if (txtscore2.getText().equals("")) {
  dialog.showMessageDialog(null, "成績(jī)輸入有誤 請(qǐng)重新輸入!");
  return false;
  }
  if (txtscore3.getText().equals("")) {
  dialog.showMessageDialog(null, "成績(jī)輸入有誤 請(qǐng)重新輸入!");
  return false;
  }
  if (txtscore4.getText().equals("")) {
  dialog.showMessageDialog(null, "成績(jī)輸入有誤 請(qǐng)重新輸入!");
  return false;
  }
  return true;
 }

 public void addStu() {
  btnAdd.addActionListener(new ActionListener() {

  public void actionPerformed(ActionEvent e) {
  if (blank() == true) {
   c.addStudent(new Student(txtNo.getText(), txtName.getText(), txtAge.getText(),txtscore1.getText(),txtscore2.getText(),txtscore3.getText(),txtscore4.getText()));
   dialog.showMessageDialog(null, "學(xué)生信息已添加成功");


  }}});
 }
 public void firstStudent() { 
  btnFirst.addActionListener(new ActionListener() {

  public void actionPerformed(ActionEvent e) {
   txtNo.setText(c.stuList.get(0).getNo());
   txtName.setText(c.stuList.get(0).getName());
   txtAge.setText(c.stuList.get(0).getAge());
   txtscore1.setText(c.stuList.get(0).getscore1());
   txtscore2.setText(c.stuList.get(0).getscore2());
   txtscore3.setText(c.stuList.get(0).getscore3());
   txtscore4.setText(c.stuList.get(0).getscore4());

  }
  });
 }
 public void lastStudent() {
  btnLast.addActionListener(new ActionListener() {

  public void actionPerformed(ActionEvent e) {
   txtNo.setText(c.stuList.get(c.stuList.size() - 1).getNo());
   txtName.setText(c.stuList.get(c.stuList.size() - 1).getName());
   txtAge.setText(c.stuList.get(c.stuList.size() - 1).getAge());
   txtscore1.setText(c.stuList.get(c.stuList.size() - 1).getscore1());
   txtscore2.setText(c.stuList.get(c.stuList.size() - 1).getscore2());
   txtscore3.setText(c.stuList.get(c.stuList.size() - 1).getscore3());
   txtscore4.setText(c.stuList.get(c.stuList.size() - 1).getscore4());
  }
  });
 }

 public void previous() {
  btnPrev.addActionListener(new ActionListener() {

  public void actionPerformed(ActionEvent e) {
   int n = 0;
   for (int i = 0; i < c.stuList.size(); i++) {
   if (c.stuList.get(i).getNo().equals(txtNo.getText())) {
    n = i - 1;
   }
   }
   if (c.stuList.get(0).getNo().equals(txtNo.getText())) {
   dialog.showMessageDialog(null, "再無(wú)上一個(gè)學(xué)生");
   } else {
   txtNo.setText(c.stuList.get(n).getNo());
   txtName.setText(c.stuList.get(n).getName());
   txtAge.setText(c.stuList.get(n).getAge());
   txtscore1.setText(c.stuList.get(n).getscore1());
   txtscore2.setText(c.stuList.get(n).getscore2());
   txtscore3.setText(c.stuList.get(n).getscore3());
   txtscore4.setText(c.stuList.get(n).getscore4());
   }
  }
  });
 }

 public void next() {
  btnNext.addActionListener(new ActionListener() {

  public void actionPerformed(ActionEvent e) {
   int n = 0;
   for (int i = 0; i < c.stuList.size(); i++) {
   if (c.stuList.get(i).getNo().equals(txtNo.getText())) {
    n = i + 1;
   }
   }
   if (c.stuList.get(c.stuList.size() - 1).getNo().equals(txtNo.getText())) {
   dialog.showMessageDialog(null, "再無(wú)下一個(gè)學(xué)生");
   } else {
   txtNo.setText(c.stuList.get(n).getNo());
   txtName.setText(c.stuList.get(n).getName());
   txtAge.setText(c.stuList.get(n).getAge());
   txtscore1.setText(c.stuList.get(n).getscore1());
   txtscore2.setText(c.stuList.get(n).getscore2());
   txtscore3.setText(c.stuList.get(n).getscore3());
   txtscore4.setText(c.stuList.get(n).getscore4());}
  }
  });
 }

 public void remove() {
  btnRemove.addActionListener(new ActionListener() {

  public void actionPerformed(ActionEvent e) {
   if (c.stuList.size() == 0) {
   JOptionPane.showMessageDialog(null, "沒有該學(xué)生信息");
   } else {
   Student s = new Student(txtNo.getText(), txtName.getText(), txtAge.getText(),txtscore1.getText(),txtscore2.getText(),txtscore3.getText(),txtscore4.getText());
   if (blank() == true) {
    System.out.println(c.stuList.contains(s));
    System.out.println(s);
    if (!c.stuList.contains(s)) {
    c.deleteStudent(s);

    JOptionPane.showMessageDialog(null, "已經(jīng)刪除成功");
    int a = 0;
    for (int i = 0; i < c.stuList.size(); i++) {
     if (c.stuList.get(i).getNo().equals(txtNo.getText())) {
     a = i + 1;
     }
    }
    if (c.stuList.size() > 0) {

     if (c.stuList.get(c.stuList.size() - 1).getNo().equals(txtNo.getText())) {
     txtNo.setText(c.stuList.get(0).getNo());
     txtName.setText(c.stuList.get(0).getName());
     txtAge.setText(c.stuList.get(0).getAge());
     txtscore1.setText(c.stuList.get(0).getscore1());
     txtscore2.setText(c.stuList.get(0).getscore2());
     txtscore3.setText(c.stuList.get(0).getscore3());
     txtscore4.setText(c.stuList.get(0).getscore4());
     } else {
     txtNo.setText(c.stuList.get(a).getNo());
     txtName.setText(c.stuList.get(a).getName());
     txtAge.setText(c.stuList.get(a).getAge());
     txtscore1.setText(c.stuList.get(a).getscore1());
     txtscore2.setText(c.stuList.get(a).getscore2());
     txtscore3.setText(c.stuList.get(a).getscore3());
     txtscore4.setText(c.stuList.get(a).getscore4());
     }
    } else {
     clear();
    }
    } else {
    dialog.showMessageDialog(null, "未來(lái)找到對(duì)應(yīng)學(xué)生的信息"); }}
   }
  }
  });
 }

 public void modify() {
  btnModify.addActionListener(new ActionListener() {

  public void actionPerformed(ActionEvent e) {
   if (c.stuList.size() == 0) {
   dialog.showMessageDialog(null, "沒有該學(xué)生信息");
   }
   for (Student s : c.stuList) {
   if (s.getNo().equals(txtNo.getText())) {
    if (blank() == true) {
    s.setName(txtName.getText());
    s.setAge(txtAge.getText());

    JOptionPane.showMessageDialog(null, "已經(jīng)修改成功");
    return;
    }
   }
   }
   JOptionPane.showMessageDialog(null, "修改失敗請(qǐng)重新操作");
  }
  });
 }

 public void check() {
  btnCheck.addActionListener(new ActionListener() {

  public void actionPerformed(ActionEvent e) {
   if ((txtNo.getText().equals(""))) {
   dialog.showMessageDialog(null, "學(xué)號(hào)不能為空 請(qǐng)從新輸入");
   } else {
   int m = 0;
   for (int i = 0; i < c.stuList.size(); i++) {
    if (c.stuList.get(i).getNo().equals(txtNo.getText())) {
    JOptionPane.showMessageDialog(null, "已查到該學(xué)生信息");
    txtName.setText(c.stuList.get(i).getName());
    txtAge.setText(c.stuList.get(i).getAge());
    txtscore1.setText(c.stuList.get(i).getscore1());
    txtscore2.setText(c.stuList.get(i).getscore2());
    txtscore3.setText(c.stuList.get(i).getscore3());
    txtscore4.setText(c.stuList.get(i).getscore4());
    break;}
     m++;}
   if (m == c.stuList.size()) {
    dialog.showMessageDialog(null, "沒有此學(xué)生的相關(guān)信息");
    return; }
   }
  }
  });
 }

 public void clear() {
  btnClear.addActionListener(new ActionListener() {

  public void actionPerformed(ActionEvent e) {
   txtNo.setText("");
   txtName.setText("");
   txtAge.setText("");
   txtscore1.setText("");
   txtscore2.setText("");
   txtscore3.setText("");
   txtscore4.setText("");
  }
  }
  );
 } 

 public static void main(String[] args) {
  new menu();  
 } 
}

關(guān)于管理系統(tǒng)的更多內(nèi)容請(qǐng)點(diǎn)擊《管理系統(tǒng)專題》進(jìn)行學(xué)習(xí)

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Java實(shí)現(xiàn)簡(jiǎn)單日歷小程序 Java圖形界面小日歷開發(fā)

    Java實(shí)現(xiàn)簡(jiǎn)單日歷小程序 Java圖形界面小日歷開發(fā)

    這篇文章主要介紹了Java實(shí)現(xiàn)簡(jiǎn)單日歷小程序,如何用Java swing開發(fā)一款簡(jiǎn)單的小日歷,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-02-02
  • Springboot單元測(cè)試無(wú)法讀取配置文件的解決方案

    Springboot單元測(cè)試無(wú)法讀取配置文件的解決方案

    這篇文章主要介紹了Springboot單元測(cè)試無(wú)法讀取配置文件的解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-01-01
  • IDEA中 Getter、Setter 注解不起作用的問(wèn)題如何解決

    IDEA中 Getter、Setter 注解不起作用的問(wèn)題如何解決

    這篇文章主要介紹了IDEA中 Getter、Setter 注解不起作用的問(wèn)題如何解決,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-08-08
  • 解決static類使用@Value獲取yml文件獲取不到的問(wèn)題

    解決static類使用@Value獲取yml文件獲取不到的問(wèn)題

    在靜態(tài)類中直接使用@Value注解無(wú)法獲取yml文件中的配置,解決方案是在工具類Utils中創(chuàng)建靜態(tài)的setter方法,并從外部類ServiceClass中調(diào)用這個(gè)方法來(lái)設(shè)置值,這種方法通過(guò)外部調(diào)用來(lái)間接設(shè)置靜態(tài)變量的值,從而成功讀取yml配置
    2024-09-09
  • IDEA中Javaweb項(xiàng)目圖片加載不出來(lái)解決方案

    IDEA中Javaweb項(xiàng)目圖片加載不出來(lái)解決方案

    在IDEA中能夠正常的預(yù)覽到圖片,但是在生成項(xiàng)目的war包時(shí),項(xiàng)目的目錄結(jié)構(gòu)卻會(huì)發(fā)生變化,所以無(wú)法訪問(wèn)圖片,本文主要介紹了IDEA中Javaweb項(xiàng)目圖片加載不出來(lái)解決方案,感興趣的可以了解一下
    2023-10-10
  • struts1之簡(jiǎn)單mvc示例_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    struts1之簡(jiǎn)單mvc示例_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    這篇文章主要介紹了struts1之簡(jiǎn)單mvc示例的相關(guān)資料,需要的朋友可以參考下
    2017-09-09
  • Java中==和equals()的區(qū)別總結(jié)

    Java中==和equals()的區(qū)別總結(jié)

    ==和equals是我們面試中經(jīng)常會(huì)碰到的問(wèn)題,那么它們之間有什么聯(lián)系和區(qū)別呢?這篇文章主要給大家介紹了關(guān)于Java中==和equals()區(qū)別的相關(guān)資料,文中通過(guò)代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2024-07-07
  • mongo分布式鎖Java實(shí)現(xiàn)方法(推薦)

    mongo分布式鎖Java實(shí)現(xiàn)方法(推薦)

    下面小編就為大家?guī)?lái)一篇mongo分布式鎖Java實(shí)現(xiàn)方法(推薦)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-07-07
  • idea快速實(shí)現(xiàn)將SpringBoot項(xiàng)目打包Docker鏡像并部署

    idea快速實(shí)現(xiàn)將SpringBoot項(xiàng)目打包Docker鏡像并部署

    本文主要介紹了idea快速實(shí)現(xiàn)將SpringBoot項(xiàng)目打包Docker鏡像并部署,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2022-04-04
  • springboot簡(jiǎn)單集成Security配置的教程

    springboot簡(jiǎn)單集成Security配置的教程

    這篇文章主要介紹了springboot簡(jiǎn)單集成Security配置的教程,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2025-03-03

最新評(píng)論

忻城县| 怀化市| 衡南县| 两当县| 合山市| 阿克陶县| 榆社县| 桓仁| 临汾市| 乌兰察布市| 莱西市| 和平区| 开江县| 东至县| 新密市| 内黄县| 北辰区| 定襄县| 高安市| 博兴县| 雷山县| 白玉县| 兴仁县| 山阴县| 望江县| 湖南省| 简阳市| 罗山县| 嘉善县| 章丘市| 中阳县| 张家界市| 建湖县| 民权县| 达州市| 东海县| 乡宁县| 平舆县| 万州区| 新宁县| 庆阳市|