Class FocusTrigger

  • All Implemented Interfaces:
    java.awt.event.FocusListener, java.util.EventListener

    public class FocusTrigger
    extends Trigger
    implements java.awt.event.FocusListener
    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

      Constructors 
      Constructor Description
      FocusTrigger​(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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static FocusTrigger addTrigger​(javax.swing.JComponent component, Animator animator, FocusTriggerEvent event)
      Creates a non-auto-reversing FocusTrigger and adds it as a FocusListener to the component.
      static FocusTrigger addTrigger​(javax.swing.JComponent component, Animator animator, FocusTriggerEvent event, boolean autoReverse)
      Creates a FocusTrigger and adds it as a FocusListener to the component.
      void focusGained​(java.awt.event.FocusEvent e)
      Called by the object which added this trigger as a FocusListener.
      void focusLost​(java.awt.event.FocusEvent e)
      Called by the object which added this trigger as a FocusListener.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FocusTrigger

        public FocusTrigger​(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.
        Parameters:
        animator - the Animator that will start when the event occurs
        event - the FocusTriggerEvent that will cause the action to fire
      • FocusTrigger

        public 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.
        Parameters:
        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.
    • Method Detail

      • addTrigger

        public static FocusTrigger addTrigger​(javax.swing.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 trigger
        animator - the Animator that will start when the event occurs
        event - the FocusTriggerEvent that will cause the action to fire
        Returns:
        FocusTrigger the resulting trigger
      • addTrigger

        public static FocusTrigger addTrigger​(javax.swing.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 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
      • focusGained

        public void focusGained​(java.awt.event.FocusEvent e)
        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 interface java.awt.event.FocusListener
      • focusLost

        public void focusLost​(java.awt.event.FocusEvent e)
        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 interface java.awt.event.FocusListener