previous | start | next

## Mouse Adapters

- What if you just want to listen to `mousePressed?`
- Extend `MouseAdapter
  `

      public class MouseAdapter implements MouseListener

      {

         public void mouseClicked(MouseEvent event) {}

         public void mousePressed(MouseEvent event) {}

         public void mouseReleased(MouseEvent event) {}

         public void mouseEntered(MouseEvent event) {}

         public void mouseExited(MouseEvent event) {}

      }

- Component constructor adds listener:

      addMouseListener(new

         MouseAdapter()

         {

            public void mousePressed(MouseEvent event)

            {

               mouse action goes here

            }

         });

previous | start | next