Class FocusTrigger
java.lang.Object
org.jdesktop.animation.timing.triggers.Trigger
org.jdesktop.animation.timing.triggers.FocusTrigger
- All Implemented Interfaces:
FocusListener
,EventListener
FocusTrigger handles focus events
and triggers an animation based on those events.
For example, to have anim start when component receives an
IN event, one might write the following:
FocusTrigger trigger = FocusTrigger.addTrigger(component, anim, FocusTriggerEvent.IN);
-
Constructor Summary
ConstructorsConstructorDescriptionFocusTrigger
(Animator animator, FocusTriggerEvent event) Creates a non-auto-reversing FocusTrigger, which should be added to a Component that will generate the focus events of interest.FocusTrigger
(Animator animator, FocusTriggerEvent event, boolean autoReverse) Creates a FocusTrigger, which should be added to a Component that will generate the focus events of interest. -
Method Summary
Modifier and TypeMethodDescriptionstatic FocusTrigger
addTrigger
(JComponent component, Animator animator, FocusTriggerEvent event) Creates a non-auto-reversing FocusTrigger and adds it as a FocusListener to the component.static FocusTrigger
addTrigger
(JComponent component, Animator animator, FocusTriggerEvent event, boolean autoReverse) Creates a FocusTrigger and adds it as a FocusListener to the component.void
Called by the object which added this trigger as a FocusListener.void
Called by the object which added this trigger as a FocusListener.
-
Constructor Details
-
FocusTrigger
Creates a non-auto-reversing FocusTrigger, which should be added to a Component that will generate the focus events of interest.- Parameters:
animator
- the Animator that will start when the event occursevent
- the FocusTriggerEvent that will cause the action to fire
-
FocusTrigger
Creates a FocusTrigger, which should be added to a Component that will generate the focus events of interest.- Parameters:
animator
- 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.
-
-
Method Details
-
addTrigger
public static FocusTrigger addTrigger(JComponent component, Animator animator, FocusTriggerEvent event) Creates a non-auto-reversing FocusTrigger and adds it as a FocusListener to the component.- Parameters:
component
- component that will generate FocusEvents for this triggeranimator
- the Animator that will start when the event occursevent
- the FocusTriggerEvent that will cause the action to fire- Returns:
- FocusTrigger the resulting trigger
-
addTrigger
public static FocusTrigger addTrigger(JComponent component, Animator animator, FocusTriggerEvent event, boolean autoReverse) Creates a FocusTrigger and adds it as a FocusListener to the component.- Parameters:
component
- component that will generate FocusEvents 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
-
focusGained
Called by the object which added this trigger as a FocusListener. This method starts the animator if the trigger is waiting for a IN event.- Specified by:
focusGained
in interfaceFocusListener
-
focusLost
Called by the object which added this trigger as a FocusListener. This method starts the animator if the trigger is waiting for a OUT event.- Specified by:
focusLost
in interfaceFocusListener
-