calculatebuttonlistener.java

来自「此系统可用于对学生成绩进行简单管理」· Java 代码 · 共 55 行

JAVA
55
字号
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class CalculateButtonListener implements ActionListener{

       DrawGUI x;
       CalculateButtonListener(DrawGUI a)
       {
         
         x=a;
       }
       public void actionPerformed(ActionEvent e)
       {
         
         if(x.labelWhatTypeOfStudent.getText().equals("交通学院学生"))
         {
         	
         	TransportationStudent tStudent=new TransportationStudent();
         	tStudent.setGaoShuGrade(Integer.parseInt(x.txt1.getText()));
         	tStudent.setYingYuGrade(Integer.parseInt(x.txt2.getText()));
         	tStudent.setDaXueWuLiGrade(Integer.parseInt(x.txt3.getText()));
         	tStudent.setMeiXueJianShangGrade(Integer.parseInt(x.txt4.getText()));
         	tStudent.setMaZheGrade(Integer.parseInt(x.txt5.getText()));
         	tStudent.setDengLunGrade(Integer.parseInt(x.txt6.getText()));
         	tStudent.setMaoGaiGrade(Integer.parseInt(x.txt7.getText()));
         	tStudent.setDaXueWuLiGrade(Integer.parseInt(x.txt8.getText()));
         	tStudent.setTiYuGrade(Integer.parseInt(x.txt9.getText()));
         	tStudent.setXianDaiGrade(Integer.parseInt(x.txt10.getText()));
         	tStudent.setGaiLvGrade(Integer.parseInt(x.txt11.getText()));
         	tStudent.setJiSuanFangFaGrade(Integer.parseInt(x.txt12.getText()));
         	tStudent.setYanTuGongChengGrade(Integer.parseInt(x.txt13.getText()));
         	tStudent.setCeLiangPingChaGrade(Integer.parseInt(x.txt14.getText()));
         	tStudent.setCPlusPlusGrade(Integer.parseInt(x.txt15.getText()));
         	
         	tStudent.setStudentID(x.txtStudentID.getText());
         	tStudent.setStudentName(x.txtStudentName());
         	
         	tStudent.calculateGradePoint();
         	//System.out.println(eStudent.test());
         	//System.out.println(eStudent.getFinalLetterGrade());
         	x.txaInformation.append("绩点:"+tStudent.getFinalGradePoint());
         	x.txaInformation.append("\n");
         	x.txaInformation.append("等级:"+tStudent.getFinalLetterGrade());
                     	                                 
         }
         else if(x.labelWhatTypeOfStudent.getText().equals("MATH STUDENT"))
         {
         	//add code
         }
         else if(x.labelWhatTypeOfStudent.getText().equals("SCIENCE STUDENT"))
         {
         	//add code
         }
       }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?