Handling Mouse Events
1. Either define a class that implements one or both of the interfaces MouseListener or MouseMotionListener, or
2. Define a class that subclasses MouseAdapter (and, maybe which implements MouseMotionListener), or
3. Declare that your main class implements MouseListener and/or MouseMotionListener.
Then, if you have implemented a new class for handling the mouse, then create an instance of it and call one or both of
addMouseListener and/or addMouseMotionListener
Otherwise call addMouseListener and/or addMouseMotionListener with this.