Is an actionListener a callback?

Discussion in 'Java' started by jmDesktop, May 24, 2008.

  1. jmDesktop

    jmDesktop Guest

    I'm just trying to understand what a callback is. I read it is a
    listener, but not sure. I have searched. Thank you for any help.
     
    jmDesktop, May 24, 2008
    #1
    1. Advertising

  2. On 2008-05-24 06:21 +0100, jmDesktop allegedly wrote:
    > I'm just trying to understand what a callback is. I read it is a
    > listener, but not sure. I have searched. Thank you for any help.


    Pretty much. All listener can be seen as delayed callbacks.

    In languages where you can have function pointers, you'd typically pass
    such a pointer to a function to be used as a callback. In Java, you'll
    declare the function to take a specific interface, and pass the function
    an implementation of that interface. Since Java sports anonymous
    classes, the process is only slightly more complicated and does
    lead, in my humble opinion, to more structured and clean code than if
    you could use function pointers.

    --
    DF.
    to reply privately, change the top-level domain
    in the FROM address from "invalid" to "net"
     
    Daniele Futtorovic, May 24, 2008
    #2
    1. Advertising

  3. jmDesktop

    Stefan Ram Guest

    jmDesktop <> writes:
    >I'm just trying to understand what a callback is.


    »Callback« is not a concept of the Java Language
    Specification, Third Edition.

    A »callback« is a callable entity that is passed
    to another entity, so that this other entity might
    call it (back).
     
    Stefan Ram, May 24, 2008
    #3
  4. jmDesktop

    jmDesktop Guest

    On May 24, 12:27 am, "Peter Duniho" <>
    wrote:
    > On Fri, 23 May 2008 21:21:37 -0700, jmDesktop <>  
    > wrote:
    >
    > > I'm just trying to understand what a callback is.  I read it is a
    > > listener, but not sure.  I have searched.  Thank you for any help.

    >
    > It depends on your definition of "callback".  In my experience, that's  
    > reserved for describing a function point of sorts, which Java doesn't have..
    >
    > But Java does use interfaces to accomplish much the same functionality.  
    > In that respect, actionListener (and the numerous other similar "listener"  
    > interfaces) could be thought of as a "callback".
    >
    > What's the context?  Where are you seeing the term "callback", and is  
    > there something about how it's used that you don't understand and you're  
    > trying to figure out?
    >
    > Pete


    Just in general. Nothing specific. I hate reading computer books
    where they expect one to know exactly what their talking about, when
    they should not suppose it. I was reading something on oop and the
    author starting talking about callbacks. It was a beginner book and I
    just have never really got the concept. Then I read something that
    said a Java listener was a callback, which kind of cleared things up.
    I can never get straight who the caller and the callee is. thanks.
     
    jmDesktop, May 24, 2008
    #4
  5. On 2008-05-24 18:58 +0100, jmDesktop allegedly wrote:
    > Just in general. Nothing specific. I hate reading computer books
    > where they expect one to know exactly what their talking about, when
    > they should not suppose it.


    Sounds like you need the reference work on this subject: "How to read
    computer books in forty-two days", by Ron Obvious and O.W.A. Giveaway,
    Aintsinno Books, Palermo, 2001.

    --
    DF.
    to reply privately, change the top-level domain
    in the FROM address from "invalid" to "net"
     
    Daniele Futtorovic, May 24, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Clive Moore

    ActionListener

    Clive Moore, Dec 2, 2003, in forum: Java
    Replies:
    2
    Views:
    686
    Clive Moore
    Dec 3, 2003
  2. Chris Lawson
    Replies:
    2
    Views:
    821
    Andrew Hobbs
    Feb 5, 2004
  3. Michael
    Replies:
    6
    Views:
    3,170
    Michael
    Jul 11, 2004
  4. Jenny
    Replies:
    1
    Views:
    6,015
    Christian Kaufhold
    Aug 9, 2004
  5. 6e
    Replies:
    1
    Views:
    9,739
Loading...

Share This Page