[Chapter 21] MouseAdapter

#

| Chapter 21 java.awt.event Reference |

# MouseAdapter

## Name

MouseAdapter

##

## Description

The `MouseAdapter` class implements the methods of `MouseListener` with empty functions. It may be easier for you to extend `MouseAdapter`, overriding only those methods you are interested in, than to implement `MouseListener` and provide the empty functions yourself.

## Class Definition

    public abstract class java.awt.event.MouseAdapter
       extends java.lang.Object
       implements java.awt.event.MouseListener {
      // Instance Methods
      public void mouseClicked (MouseEvent e);
      public void mouseEntered (MouseEvent e);
      public void mouseExited (MouseEvent e);
      public void mousePressed (MouseEvent e);
      public void mouseReleased (MouseEvent e);
    }

## Instance Methods

### mouseClicked

#### public void mouseClicked (MouseEvent e)

Parameters

  e

    The event that has occurred.

Description

  Does nothing. Override this function to be notified when the mouse button is clicked (pressed and released).

### mouseEntered

#### public void mouseEntered (MouseEvent e)

Parameters

  e

    The event that has occurred.

Description

  Does nothing. Override this function to be notified when the user moves the mouse cursor into a component.

### mouseExited

#### public void mouseExited (MouseEvent e)

Parameters

  e

    The event that has occurred.

Description

  Does nothing. Override this function to be notified when the moves the mouse cursor out of a component.

### mousePressed

#### public void mousePressed (MouseEvent e)

Parameters

  e

    The event that has occurred.

Description

  Does nothing. Override this function to be notified when the mouse button is pressed.

### mouseReleased

#### public void mouseReleased (MouseEvent e)

Parameters

  e

    The event that has occurred.

Description

  Does nothing. Override this function to be notified when the mouse button is released.

## See Also

`MouseEvent`, `MouseListener`

KeyListener |  | MouseEvent