类“不是抽象的,并且不覆盖抽象方法”。错误 [英] Class "is not abstract and does not override abstract method" error
本文介绍了类“不是抽象的,并且不覆盖抽象方法”。错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在 https://youtu.be/64V8CC7nSok 上学习Java教程。我已经从视频中复制了代码100%,但仍然出现此错误:
I am following a Java tutorial at https://youtu.be/64V8CC7nSok. I have copied the code 100% from the video, but still I get this error:
Board is not abstract and does not override abstract method actionPerformed(ActionEvent) in ActionListener
这是错误为 Board.java
的文件,足以重现该问题:
Here is the file with the error, Board.java
, which is sufficient to reproduce the problem:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Board extends JPanel implements ActionListener{
private Timer timer;
public Board() {
timer = new Timer(25, this);
timer.start();
}
public void actionPeformed(ActionEvent e) {
repaint();
}
public void paint(Graphics g) {
super.paint(g);
g.setColor(Color.red);
g.fillRect(45, 60, 32, 32);
}
}
是与编码无关的问题吗?但是软件设置或版本是?
Is it a problem that is not related to the coding but the software settings or version?
推荐答案
您拼错了actionPerformed!
You misspelled actionPerformed!
这篇关于类“不是抽象的,并且不覆盖抽象方法”。错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文