java - ActionListener gets an error it says(Finals is not abstract and does not override abstract method) -


here code.

import java.awt.*; import java.awt.event.*;  public class finals extends frame implements  windowlistener,actionlistener{ public textfield tf1; public button btn0,btn1,btn2,btn3,btn4,btn5,btn6,btn7,btn8,btn9,btnadd,btnminus,btndivide,btnmultiply,btnequals,btnbackspace;  public finals(){      panel outputpanel = new panel(new flowlayout());      tf1 = new textfield(" ",30);      outputpanel.add(tf1);      panel btnpanel = new panel(new gridlayout (5,5));       btn0 = new button ("0");      btn1 = new button ("1");      btn2 = new button ("2");      btn3 = new button ("3");      btn4 = new button ("4");      btn5 = new button ("5");      btn6 = new button ("6");      btn7 = new button ("7");      btn8 = new button ("8");      btn9 = new button ("9");       btnadd= new button("+");      btnminus = new button("-");      btndivide = new button ("/");      btnmultiply = new button ("*");      btnequals = new button ("=");      btnbackspace= new button("<-");      btnpanel.add(btnadd);     btnpanel.add(btnminus);     btnpanel.add(btndivide);     btnpanel.add(btnmultiply);     btnpanel.add(btnequals);     btnpanel.add(btnbackspace);      btnpanel.add(btn1);     btnpanel.add(btn2);     btnpanel.add(btn3);     btnpanel.add(btn4);     btnpanel.add(btn5);     btnpanel.add(btn6);     btnpanel.add(btn7);     btnpanel.add(btn8);     btnpanel.add(btn9);     btnpanel.add(btn0);      setlayout(new borderlayout());     add(outputpanel,borderlayout.north);     add(btnpanel,borderlayout.south);     setvisible (true);     setsize (300,200);     settitle("calculator");     setlocationrelativeto(null);     setresizable(false);     addwindowlistener(this); }  public static void mainr(string[]args){         finals awt = new finals();     }      public void windowclosing(windowevent we){             system.exit(0);         }      public void windowclosed(windowevent we){};      public void windowopened(windowevent we){};      public void windowiconified(windowevent we){};      public void windowdeiconified(windowevent we){};      public void windowactivated(windowevent we){};      public void windowdeactivated(windowevent we){}; } 

you have implemented interface actionlistener need override actionperformed method interface otherwise declare class abstract.

    @override     public void actionperformed(actionevent e) {        //your code goes here     } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -