Package org.jdesktop.animation.timing.triggers

## Class MouseTrigger

- java.lang.Object
- - org.jdesktop.animation.timing.triggers.Trigger
  - - org.jdesktop.animation.timing.triggers.MouseTrigger

All Implemented Interfaces:
  `java.awt.event.MouseListener`, `java.util.EventListener`

    public class MouseTrigger
    extends Trigger
    implements java.awt.event.MouseListener

MouseTrigger handles mouse events and triggers an animation based on those events. For example, to have anim start when component receives an ENTER event, one might write the following:

         MouseTrigger trigger =
             MouseTrigger.addTrigger(component, anim, MouseTriggerEvent.ENTER);

### Constructor Summary

Constructors
`MouseTrigger​(Animator animator, MouseTriggerEvent event)` Creates a non-auto-reversing MouseTrigger, which should be added to a Component that will generate the mouse events of interest
`MouseTrigger​(Animator animator, MouseTriggerEvent event, boolean autoReverse)` Creates a MouseTrigger, which should be added to a Component that will generate the mouse events of interest

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static MouseTrigger` `addTrigger​(javax.swing.JComponent component, Animator animator, MouseTriggerEvent event)` Creates a non-auto-reversing MouseTrigger and adds it as a listener to component.
`static MouseTrigger` `addTrigger​(javax.swing.JComponent component, Animator animator, MouseTriggerEvent event, boolean autoReverse)` Creates a MouseTrigger and adds it as a listener to component.
`void` `mouseClicked​(java.awt.event.MouseEvent e)` Called by the object which added this trigger as a MouseListener.
`void` `mouseEntered​(java.awt.event.MouseEvent e)` Called by the object which added this trigger as a MouseListener.
`void` `mouseExited​(java.awt.event.MouseEvent e)` Called by the object which added this trigger as a MouseListener.
`void` `mousePressed​(java.awt.event.MouseEvent e)` Called by the object which added this trigger as a MouseListener.
`void` `mouseReleased​(java.awt.event.MouseEvent e)` Called by the object which added this trigger as a MouseListener.

### Methods inherited from class org.jdesktop.animation.timing.triggers.Trigger

`disarm, fire, fire`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### MouseTrigger

    public MouseTrigger​(Animator animator,
                        MouseTriggerEvent event)

Creates a non-auto-reversing MouseTrigger, which should be added to a Component that will generate the mouse events of interest

#### MouseTrigger

    public MouseTrigger​(Animator animator,
                        MouseTriggerEvent event,
                        boolean autoReverse)

Creates a MouseTrigger, which should be added to a Component that will generate the mouse events of interest

### Method Detail

#### addTrigger

    public static MouseTrigger addTrigger​(javax.swing.JComponent component,
                                          Animator animator,
                                          MouseTriggerEvent event)

Creates a non-auto-reversing MouseTrigger and adds it as a listener to component.

Parameters:
  `component` - component that will generate MouseEvents for this trigger
  `animator` - the Animator that will start when the event occurs
  `event` - the MouseTriggerEvent that will cause the action to fire
Returns:
  MouseTrigger the resulting trigger

#### addTrigger

    public static MouseTrigger addTrigger​(javax.swing.JComponent component,
                                          Animator animator,
                                          MouseTriggerEvent event,
                                          boolean autoReverse)

Creates a MouseTrigger and adds it as a listener to component.

Parameters:
  `component` - component that will generate MouseEvents for this trigger
  `animator` - the Animator that will start when the event occurs
  `event` - the FocusTriggerEvent that will cause the action to fire
  `autoReverse` - flag to determine whether the animator should stop and reverse based on opposite triggerEvents.
Returns:
  FocusTrigger the resulting trigger

#### mouseEntered

    public void mouseEntered​(java.awt.event.MouseEvent e)

Called by the object which added this trigger as a MouseListener. This method starts the animator if the trigger is waiting for an ENTER event.

Specified by:
  `mouseEntered` in interface `java.awt.event.MouseListener`

#### mouseExited

    public void mouseExited​(java.awt.event.MouseEvent e)

Called by the object which added this trigger as a MouseListener. This method starts the animator if the trigger is waiting for an EXIT event.

Specified by:
  `mouseExited` in interface `java.awt.event.MouseListener`

#### mousePressed

    public void mousePressed​(java.awt.event.MouseEvent e)

Called by the object which added this trigger as a MouseListener. This method starts the animator if the trigger is waiting for a PRESS event.

Specified by:
  `mousePressed` in interface `java.awt.event.MouseListener`

#### mouseReleased

    public void mouseReleased​(java.awt.event.MouseEvent e)

Called by the object which added this trigger as a MouseListener. This method starts the animator if the trigger is waiting for a RELEASE event.

Specified by:
  `mouseReleased` in interface `java.awt.event.MouseListener`

#### mouseClicked

    public void mouseClicked​(java.awt.event.MouseEvent e)

Called by the object which added this trigger as a MouseListener. This method starts the animator if the trigger is waiting for a CLICK event.

Specified by:
  `mouseClicked` in interface `java.awt.event.MouseListener`