Я продолжаю получать эту ошибку и, кажется, не могу понять, почему какие-либо идеи? (Не компилируются) Это апплет, созданный из моего рабочего консольного приложения (по образовательным причинам). Спасибо, парни...
ошибка: BodyMassApplet не является абстрактным и не переопределяет абстрактный метод actionPerformed(ActionEvent) в общедоступном классе ActionListener BodyMassApplet расширяет апплет, реализует ActionListener
код:
/*
Name : ****************
Date : 13/02/14
Reason : Bodymass calculator
Chapter : 3
Programs Name : BodyMassApplet.java
*/
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class BodyMassApplet extends Applet implements ActionListener
{
//declare vars
Image logo;//declare an image object
int inches, pounds;
double meters, kilograms, index;
//construct components
Label companyLabel = new Label ("THE SUN FITNESS CENTER BODY MASS INDEX CALCULATOR");
Label heightLabel = new Label("Enter your height to the nearest inch : ");
TextField heightFeild = new TextField (10);
Label weightLabel = new Label ("Enter your weight to the nearest pound : ");
TextField weightFeild = new TextField (10);
Button calcButton = new Button ("Calculate");
Label outputLabel = new Label ("Click the Calculate button to see your Body Mass Index. ");
public void init()
{
setForeground(Color.red);
add(companyLabel);
add(heightLabel);
add(heightFeild );
add(weightLabel);
add(weightFeild);
add(calcButton);
calcButton.addActionListener(this);
add(outputLabel);
logo = getImage(getDocumentBase(),"log.gif");
}//Close init method
public void actionPerfomed(ActionEvent e)
{
inches = Integer.parseInt(heightFeild.getText());
pounds = Integer.parseInt(weightFeild.getText());
meters = inches /39.36;
kilograms =pounds /2.2;
index = kilograms / Math.pow(meters,2);
outputLabel.setText("Your Body Mass Index Is" + Math.round(index)+ ".");
}
public void paint(Graphics g)
{
g.drawImage(logo,125,160,this);
}
}//close applet class