Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: actionPerformed method

  1. #1
    Junior Member
    Join Date
    Nov 2010
    Posts
    16
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default actionPerformed method

    In a program I am working on of the class named TextEditor I have the following method:
    public void actionPerformed(ActionEvent event)
    Even before compiling it shows the following errors:
     
      
    Multiple markers at this line
    - implements java.awt.event.ActionListener.actionPerformed
    - The method actionPerformed(ActionEvent) of type TextEditor must override a superclass



    What am I missing? (Yes, it has code following it enclosed in {}'s).

    Thanks in advance,

    Deprogrammer
    Last edited by Deprogrammer; December 3rd, 2010 at 09:58 PM.


  2. #2
    Junior Member
    Join Date
    Nov 2010
    Posts
    16
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: actionPerformed method

    I just fixed it by removing a "@Override" tag that had been above that method. I don't why it was even there, but now my program works. Thanks again.

  3. #3
    Junior Member
    Join Date
    Nov 2010
    Posts
    16
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: actionPerformed method

    Is it possible to just delete this thread? Unless, of course, there is some sort of use to be found in it...

  4. #4
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: actionPerformed method

    If you removed the @Override annotation and that fixes your compilation problem, then that means you didn't properly override the actionPerformed method. In this case, there are a few things to check:
    1. Did you remember to have your class extend/implement some class/interface?
    2. Is the method spelled correctly (Java is case-sensitive)?
    3. Do you have the parameters correct (both type and order matter, name not so much)?
    4. Do you have at least the access level defined in the superclass? This means that if a method was declared protected in the super class, it must be protected or public in your class?

Similar Threads

  1. actionPerformed
    By Kumarrrr in forum Java Theory & Questions
    Replies: 5
    Last Post: November 23rd, 2010, 09:08 AM
  2. Can i call init() method in destroy method.?
    By muralidhar in forum Java Servlet
    Replies: 1
    Last Post: October 22nd, 2010, 11:18 AM