View Single Post
  #1 (permalink)  
Old 01-03-2008, 03:37 PM
hasani6leap hasani6leap is offline
Member
 
Join Date: Jan 2008
Posts: 5
hasani6leap is on a distinguished road
Error! "filename" is not abstract and does not override abstract method...

I'm trying to create a simple GUI with swing I get compilation error..
"Tempconverter is not absract and does not override absract method actionPerformed (java.awt.event.ActionEvent) in (java.awt.event.ActionListener).

This is my code


import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;

public class Tempconverter extends JFrame implements ActionListener{

//actionlistener is in event sub package
JTextField celcius;
JButton convert;
JTextField farenhite;





Tempconverter(){

celcius =new JTextField (15);
farenhite=new JTextField (15);
convert=new JButton("convert");

//Insert Layout manager to arrange the componetes
setLayout(new FlowLayout());

//if the 'convert' button is pushed the button informs the same object
//this is the reference to the same object
convert.ActionListener(this);
//adding components to the pane
getContentPane().add(celcius);
getContentPane().add(convert);
getContentPane().add(farenhite);

}


public void actionPerfomed(ActionEvent ev){

int value=Integer.parseInt(celcius.getText());
int far=(value*9/5)+32;
farenhite.setText(Integer.toString(far));
}


public static void main( String args[]){

Tempconverter tc=new Tempconverter();
tc.setSize(500,500);
tc.setVisible(true);


}
}
Thankx
Reply With Quote
Sponsored Links