Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-03-2008, 04:37 PM
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-03-2008, 05:19 PM
jelly's Avatar
Member
 
Join Date: Jan 2008
Location: Somerset, UK
Posts: 46
jelly is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 01-03-2008, 06:47 PM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 841
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
Quote:
Originally Posted by hasani6leap View Post

"Tempconverter is not absract and does not override absract method actionPerformed

You must override the method it's telling you to override. And as jelly pointed out, that's why(simple mistake - we all make them).
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 01-06-2008, 04:54 PM
Member
 
Join Date: Jan 2008
Posts: 5
hasani6leap is on a distinguished road
Thanks guys or girls..
I do this all the time..
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 01-06-2008, 06:59 PM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 334
tim is on a distinguished road
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.
__________________
If your ship has not come in yet then build a lighthouse.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 10-27-2008, 01:44 AM
Member
 
Join Date: Oct 2008
Posts: 3
Hevonen is on a distinguished road
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:
Code:
Filename.java:24: cannot find symbol symbol : method ActionListener(Filename) location: class javax.swing.JButton convert.ActionListener(this); ^ 1 error
What does this error message mean?
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 10-27-2008, 02:25 AM
Fubarable's Avatar
Senior Member
 
Join Date: Jun 2008
Posts: 805
Fubarable is on a distinguished road
1) He likely has a typo and it should have read:
Code:
convert.addActionListener(this);
2) What the heck are you doing answering threads that are months old? Hasan has likely moved on to more relevant issues. I suggest that you do the same.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Cannont find symbol Constructor" error Welsh New To Java 7 01-25-2008 02:12 AM
Strange error message "Source not found" ppayal Eclipse 0 11-25-2007 08:19 PM
Syntax error on token "(", ; expected baltimore AWT / Swing 1 08-01-2007 01:34 AM
Error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException romina New To Java 1 07-26-2007 12:55 AM
method not abstract, does not override actionperformed method. Theman New To Java 1 05-08-2007 08:13 AM


All times are GMT +3. The time now is 01:22 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org