Class MouseTrigger
java.lang.Object
org.jdesktop.animation.timing.triggers.Trigger
org.jdesktop.animation.timing.triggers.MouseTrigger
- All Implemented Interfaces:
MouseListener,EventListener
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
ConstructorsConstructorDescriptionMouseTrigger(Animator animator, MouseTriggerEvent event) Creates a non-auto-reversing MouseTrigger, which should be added to a Component that will generate the mouse events of interestMouseTrigger(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
Modifier and TypeMethodDescriptionstatic MouseTriggeraddTrigger(JComponent component, Animator animator, MouseTriggerEvent event) Creates a non-auto-reversing MouseTrigger and adds it as a listener to component.static MouseTriggeraddTrigger(JComponent component, Animator animator, MouseTriggerEvent event, boolean autoReverse) Creates a MouseTrigger and adds it as a listener to component.voidCalled by the object which added this trigger as a MouseListener.voidCalled by the object which added this trigger as a MouseListener.voidCalled by the object which added this trigger as a MouseListener.voidCalled by the object which added this trigger as a MouseListener.voidCalled by the object which added this trigger as a MouseListener.
-
Constructor Details
-
MouseTrigger
Creates a non-auto-reversing MouseTrigger, which should be added to a Component that will generate the mouse events of interest -
MouseTrigger
Creates a MouseTrigger, which should be added to a Component that will generate the mouse events of interest
-
-
Method Details
-
addTrigger
public static MouseTrigger addTrigger(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 triggeranimator- the Animator that will start when the event occursevent- the MouseTriggerEvent that will cause the action to fire- Returns:
- MouseTrigger the resulting trigger
-
addTrigger
public static MouseTrigger addTrigger(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 triggeranimator- the Animator that will start when the event occursevent- the FocusTriggerEvent that will cause the action to fireautoReverse- flag to determine whether the animator should stop and reverse based on opposite triggerEvents.- Returns:
- FocusTrigger the resulting trigger
-
mouseEntered
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:
mouseEnteredin interfaceMouseListener
-
mouseExited
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:
mouseExitedin interfaceMouseListener
-
mousePressed
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:
mousePressedin interfaceMouseListener
-
mouseReleased
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:
mouseReleasedin interfaceMouseListener
-
mouseClicked
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:
mouseClickedin interfaceMouseListener
-