Adapter vs Listener

Posted on 2005-05-16
Last Modified: 2008-03-03
what is the difference between an adapter and a listener. I have been using ActionListener and ItemListener often. I also came across WindowAdapter but I dont use it.  
Question by:eugene007
    LVL 92

    Accepted Solution

    In that context Adapters are implementations of the listener with empty methods.
    This save you having to impelement every method if for example you are only interested in one.
    LVL 92

    Expert Comment


    Author Comment

    So it means that if a class implements a Listener, it must also implement all the methods in the Listener. In the case of an adapter, you can choose which method you wish to implement.?
    LVL 92

    Expert Comment

    Thas right, because the adapter has provided (empty) implementations for you.
    LVL 14

    Expert Comment

    But You won't be able to implement any Adapter, it's a class, and that's what it makes less usable.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    how to extract window origin in spring 2 55
    copyEndy  challenge 15 40
    json format text only 4 50
    wordcount challenge 11 48
    Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now