> Yes, a Listener is "called back" when a certain event
> has occured.
> Of course a Listener must be registered at an event
> source first if it
> wants to be called back.
Please Mr. Fake Intimacy, don't dip into things you don't understand.
In design patterns you use the Command pattern as a replacement for procedural call-backs
> kind regards,
>
> Jos
And zip up please, everybody's already seen your willy.
Jos:
The OP asked if they are the same, not if a listener could be interpreted as a callback. Those are two very different questions.
> Is callback and listener same?
No they are not the same. In the context of Java, a listener is a bundle of callbacks. For example, WindowListener is a bundle of seven callbacks for events related to a window. It would be more appropriate to say that a listener uses a callback or bundle of callbacks to "listen" for events. This does not make a listener itself a callback and it certainly doesn't make a callback a listener. This is better known as the Observer (or publish subscribe) pattern where one or more objects called observers (or listeners) may be registered on another object (called source/subject) to observe an event that the source might raise.
> No they are not the same. In the context of Java, a listener is a
> bundle of callbacks. For example, WindowListener is a bundle of
> seven callbacks for events related to a window.
You're right; I forgot about those multiple method Listeners, I just
thought of ActionListeners and other simple (single method) Listeners.
The latter are simply callbacks, your example certainly is a bundle
of callbacks.
kind regards,
Jos