For example, a table-model event might be fired when a table model receives new data from a database. Whenever possible, you should listen for semantic events rather than low-level events. That way, you can make your code as robust and portable as possible. This subsection tells you how to use adapters and inner classes to reduce clutter in your code. If you don't care about this subject, feel free to skip to the next section .
Most listener interfaces contain more than one method.
Even if you care only about mouse clicks, if your class directly implements MouseListener , then you must implement all five MouseListener methods. Methods for those events you don't care about can have empty bodies. Unfortunately, the resulting collection of empty method bodies can make code harder to read and maintain. To help you avoid cluttering your code with empty method bodies, the API generally includes an adapter class for each listener interface with more than one method. For example, the MouseAdapter class implements the MouseListener interface.