Package org.jdesktop.animation.timing.triggers

# Class ActionTrigger

java.lang.Object
org.jdesktop.animation.timing.triggers.Trigger
org.jdesktop.animation.timing.triggers.ActionTrigger

All Implemented Interfaces:
  `ActionListener`, `EventListener`

public class ActionTrigger extends Trigger implements ActionListener
ActionTrigger handles action events and starts the animator when actions occur. For example, to have anim start when a button is clicked, one might write the following:

         ActionTrigger trigger = ActionTrigger.addTrigger(button, anim);

## Constructor Summary

Constructors
Constructor
Description
`ActionTrigger(Animator animator)`
Creates an ActionTrigger that will start the animator upon receiving any ActionEvents.

## Method Summary

Modifier and Type
Method
Description
`void`
`actionPerformed(ActionEvent ae)`
Called by an object generating ActionEvents to which this trigger was added as an ActionListener.
`static ActionTrigger`
`addTrigger(Object object, Animator animator)`
Creates an ActionTrigger and adds it as a listener to object.

### 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 Details

### ActionTrigger

public ActionTrigger(Animator animator)
Creates an ActionTrigger that will start the animator upon receiving any ActionEvents. It should be added to any suitable object with an addActionListener method.

Parameters:
  `animator` - the Animator that start when the event occurs

## Method Details

### addTrigger

public static ActionTrigger addTrigger(Object object, Animator animator)
Creates an ActionTrigger and adds it as a listener to object.

Parameters:
  `object` - an object that will be used as an event source for this trigger. This object must have the method addActionListener.
  `animator` - the Animator that start when the event occurs
Returns:
  ActionTrigger the resulting trigger
Throws:
  `IllegalArgumentException` - if object has no `addActionListener()`

### actionPerformed

public void actionPerformed(ActionEvent ae)
Called by an object generating ActionEvents to which this trigger was added as an ActionListener. This starts the Animator.

Specified by:
  `actionPerformed` in interface `ActionListener`