Results 1 to 7 of 7
- 01-03-2008, 03:37 PM #1
Member
- Join Date
- Jan 2008
- Posts
- 5
- Rep Power
- 0
Error! "filename" is not abstract and does not override abstract method...
:confused:
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
- 01-03-2008, 04:19 PM #2
If that's truly a copy of your code then your problem is a simple typo
you wrote:
public void actionPerfomed(ActionEvent ev){
it should be:
public void actionPerformed(ActionEvent ev){
i.e. you missed the second 'r' in action Performed
- 01-03-2008, 05:47 PM #3Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice? Vote now!
Got a little Capt'n in you? (drink responsibly)
- 01-06-2008, 03:54 PM #4
Member
- Join Date
- Jan 2008
- Posts
- 5
- Rep Power
- 0
Thanks guys or girls..:)
I do this all the time..
- 01-06-2008, 05:59 PM #5
Typo tip
Hello hasani6leap.
Every programmer has made a typo once. In my opinion, if you type less you make less typing mistakes. Today, a programmer does not have to type out everything. Many IDEs provide shortcuts by giving you a list of methods, code snippets and more to complete code for you. For example, NetBeans can create method definitions for methods that you still need to implement, if you press ctrl+space and choose the correct method. (shown with "-implement") Try looking into this. It might help. ;)Eyes dwelling into the past are blind to what lies in the future. Step carefully.
- 10-27-2008, 12:44 AM #6
Member
- Join Date
- Oct 2008
- Posts
- 13
- Rep Power
- 0
I pasted all the code in your post to a single java-file. I tried to run your code where the typo is fixed. However, I got the following error message:
Java Code:Filename.java:24: cannot find symbol symbol : method ActionListener(Filename) location: class javax.swing.JButton convert.ActionListener(this); ^ 1 error
-
Similar Threads
-
method not abstract, does not override actionperformed method.
By Theman in forum New To JavaReplies: 2Last Post: 03-26-2010, 06:12 PM -
Syntax error on token "(", ; expected
By baltimore in forum AWT / SwingReplies: 3Last Post: 10-28-2009, 01:19 AM -
"Cannont find symbol Constructor" error
By Welsh in forum New To JavaReplies: 7Last Post: 01-25-2008, 01:12 AM -
Strange error message "Source not found"
By ppayal in forum EclipseReplies: 0Last Post: 11-25-2007, 07:19 PM -
Error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
By romina in forum New To JavaReplies: 1Last Post: 07-25-2007, 11:55 PM
Bookmarks