0
이 오류가 계속 발생하고 이유가 무엇인지 알아낼 수 있습니까? (컴파일되지 않음) 이것은 내 작업 콘솔에서 작성된 애플릿입니다. 앱 (교육적 이유). 고마워 ...오류가 발생합니다 : BodyMassApplet은 추상이 아니며 추상 메서드를 덮어 쓰지 않습니다. actionPerformed (ActionEvent)
오류 : BodyMassApplet 추상적하지 않고있는 ActionListener에서의 actionPerformed (ActionEvent를가) 공용 클래스 BodyMassApplet 애플릿이
코드 ActionListener를 구현 확장 추상 메소드를 오버라이드 (override)하지 않는 :
/*
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
프로그래머는 주제와 관련이없는 질문에 대답하지 마십시오. 돈 '더 혼란을 만듭니다. 오프 토픽으로 플래그를 달고 조언 (코멘트에서) OP는 Stack Overflow에서 물어 봅니다. gnat처럼. – trejder
고마워 얘들 아, 질문을 한 후 몇 분 만 찾았지만 내 자신의 질문에 대답 할만한 충분한 포인트가 없다 ... 물론 내가 일식에 대해 알고 있지만, 내가하는 일은 소프트웨어와 함께한다. 자바 코스 그래서 내가 IDE를 사용하여 기본 편집기를 사용하지 않아도 .... 이상하게 들릴지도 모르지만, 어떻게 주제에서 벗어난이 자바 교환입니까? – Reign