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 3 of 3

Thread: ActionListener + FocusListener -> same class?

  1. #1
    Junior Member Dario's Avatar
    Join Date
    Jan 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default ActionListener + FocusListener -> same class?

    Hello, Just a quick question

    If i got a class that implements ActionListener and it does my event handling for my textfields and stuff. How do i write my focusListener within my ActionListener class?

    I have already created a seperated class for my focusListener however i want to combined them into one class

    I've been scratching my head for a few hours. and i'm just stump.

    My program does what i want but i just want it in one neat file =(.

    i thought it be easy and be something like this? but i honestly don't know the grammar for implementing stuff.
    public class name implements ActionListener, FocusListener{
    }
    Last edited by Dario; February 11th, 2011 at 04:45 AM.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: ActionListener + FocusListener -> same class?

    What have you tried and what went wrong? The above syntax should work so long as your class actually implements the interfaces.

  3. #3
    Junior Member Dario's Avatar
    Join Date
    Jan 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: ActionListener + FocusListener -> same class?

    wow i thought my grammar was wrong.

    I found out my problem i was trying to compile right away without the necessary focus method.

    -___-


    thanks a lot

Similar Threads

  1. ActionListener help
    By QBird in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 1st, 2011, 12:25 PM
  2. Calling the actionlistener class depending on variables
    By zidsal in forum Java Theory & Questions
    Replies: 3
    Last Post: January 5th, 2011, 08:52 AM
  3. [SOLVED] ActionListener help
    By kbwalker87 in forum What's Wrong With My Code?
    Replies: 13
    Last Post: October 14th, 2010, 06:57 PM
  4. interface class ActionListener
    By NightFire91 in forum Java Theory & Questions
    Replies: 2
    Last Post: August 17th, 2010, 10:42 AM
  5. Construct a class that implement ActionListener with no constructor
    By striko_514 in forum Java Theory & Questions
    Replies: 1
    Last Post: July 5th, 2010, 03:15 PM