以下は私のコードです。エラーをスローしているものを強調します。これを修正する方法が完全にわかりません...
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.awt.event.ActionListener.*;
import java.awt.event.TextListener.*;
public abstract class GradeAverage extends Applet
implements ActionListener, TextListener{
Button Ok=new Button("Ok");
Button Cancel=new Button("cancel");
TextField Math=new TextField("Math Grade",2);
TextField Science=new TextField("Scien Grade",2);
TextField SocialStudies=new TextField("Social Studies Grade",2);
TextField English=new TextField("English Grade",2);
TextField Elective=new TextField("Elective Grade",2);
TextField Elective2=new TextField("2nd Elective Grade",2);
TextArea message=new TextArea();
public void init(){
GridBagLayout gbl=new GridBagLayout();
setLayout(gbl);
GridBagConstraints c=new GridBagConstraints();
c.anchor=GridBagConstraints.WEST;
c.weightx=2.0;
c.weighty=2.0;
c.fill=GridBagConstraints.HORIZONTAL;
c.insets=new Insets(10,10,10,10);
gbl.setConstraints(Math,c); add(Math);
c.fill=GridBagConstraints.NONE;
gbl.setConstraints(Science,c); add(Science);
c.fill=GridBagConstraints.HORIZONTAL;
gbl.setConstraints(SocialStudies,c); add(SocialStudies);
c.gridy=1;
gbl.setConstraints(English,c); add(English);
c.gridy=2;
gbl.setConstraints(Elective,c); add(Elective);
c.fill=GridBagConstraints.NONE;
gbl.setConstraints(Elective2,c); add(Elective2);
c.gridy=3;
c.anchor=GridBagConstraints.CENTER;
gbl.setConstraints(Ok,c); add(Ok);
gbl.setConstraints(Cancel,c); add(Cancel);
c.gridy=4;
c.gridwidth=3;
c.fill=GridBagConstraints.BOTH;
gbl.setConstraints(message,c); add(message);
Math.addTextListener(this);
Science.addTextListener(this);
SocialStudies.addTextListener(this);
English.addTextListener(this);
Elective.addTextListener(this);
Elective2.addTextListener(this);
Ok.addActionListener(this);
Cancel.addActionListener(this);
}
public void actionPerformed(ActionEvent event){
Object Source=event.getSource();
if(Source==Ok){
Math.getText();
Science.getText();
SocialStudies.getText();
English.getText();
Elective.getText();
Elective2.getText();
do{
**message=(Math+Science+SocialStudies+English+Elective+Elective2)/6;**
system.println("Your grade average is"+message);
}while (message<0);
if(Source==Cancel){
system.ext(0);
}
}}}
エラーをスローするコードは、** でマークされます
助けてください!
ありがとう