Class ActionTrigger
java.lang.Object
org.jdesktop.animation.timing.triggers.Trigger
org.jdesktop.animation.timing.triggers.ActionTrigger
- All Implemented Interfaces:
ActionListener,EventListener
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
ConstructorsConstructorDescriptionActionTrigger(Animator animator) Creates an ActionTrigger that will start the animator upon receiving any ActionEvents. -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled by an object generating ActionEvents to which this trigger was added as an ActionListener.static ActionTriggeraddTrigger(Object object, Animator animator) Creates an ActionTrigger and adds it as a listener to object.
-
Constructor Details
-
ActionTrigger
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
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 noaddActionListener()
-
actionPerformed
Called by an object generating ActionEvents to which this trigger was added as an ActionListener. This starts the Animator.- Specified by:
actionPerformedin interfaceActionListener
-