Class is not abstract and does not override abstract method AWT Program

后端 未结 3 1370
时光取名叫无心
时光取名叫无心 2021-01-26 18:27
import java.awt.*;
import java.awt.event.*;

public class QuadraticSolver extends Frame implements ActionListener, WindowListener
{
private TextField tfX2;
private TextF         


        
相关标签:
3条回答
  • 2021-01-26 18:51

    As you have used ActionListener so you are bound to override its method which is actionPerformed(ActionEvent ae) otherwise it will give this error.

    0 讨论(0)
  • 2021-01-26 19:04

    I Noticed that you implement actionperformed for your actionlistener of your button.When you declare that you are going to implement an interface, you need a separate actionperformed method in your class. like

    public class QuadraticSolver implements ActionListener{
    @Override 
    public void  actionPerformed(ActionEvent){}
    }
    
    0 讨论(0)
  • 2021-01-26 19:07

    Since QuadraticSolver implements ActionListener, it should implement actionPerformed.

    You implemented that method in an anonymous class.

    To solve it, either add an implementation of actionPerformed to QuadraticSolver or don't require QuadraticSolver to implement that interface.

    0 讨论(0)
提交回复
热议问题