previous | start | next

Implementing the MouseListener: 2

The MouseListener interface has 5 methods to implement.

For the mouse controller used in this program, only one of the methods does anything - mousePressed.

Instead of writing the 4 other methods with empty bodies, there is a class that already does that for all 5 methods - MouseAdapter.

So our mouse controller class can just inherit from MouseAdapter and then override the 1 method mousePressed.



previous | start | next