Class Flashable


  • public abstract class Flashable
    extends java.lang.Object
    Flashable is a basic interface to enable flashing in any component. Internally it uses Animator to create the flashing effect.

    Whenever a Flashable is installed to a JComponent, you can always use isFlashableInstalled(javax.swing.JComponent) to check if it is installed.

    • Field Detail

      • CLIENT_PROPERTY_FLASHABLE

        public static final java.lang.String CLIENT_PROPERTY_FLASHABLE
        See Also:
        Constant Field Values
      • _component

        protected javax.swing.JComponent _component
      • _animator

        protected Animator _animator
      • _timer

        protected javax.swing.Timer _timer
    • Constructor Detail

      • Flashable

        public Flashable​(javax.swing.JComponent component)
    • Method Detail

      • getSynchronizedFlashFlag

        public static boolean getSynchronizedFlashFlag()
        Gets the flash flag. We have an internal timer which sets this flag value. All Flashables will use the same flash flag so that they are all in sync when flashing.
        Returns:
        true or false. True means the flash is on and false means flash is off.
      • getComponent

        public javax.swing.JComponent getComponent()
        Gets the table that will flash.
        Returns:
        the table.
      • setComponent

        public void setComponent​(javax.swing.JComponent component)
        Sets the table that will flash.
        Parameters:
        component - the new table.
      • getInterval

        public int getInterval()
        Gets the interval, in ms.
        Returns:
        the interval.
      • setInterval

        public void setInterval​(int interval)
        Sets the interval, in ms. If the flashing is running, the new interval will take effect immediately. By default, it is 300 ms.
        Parameters:
        interval - the new interval.
      • flash

        public abstract void flash()
        This method actually does the flashing. This method is called in the actionPerformed of the timer.
      • clearFlashing

        public abstract void clearFlashing()
        Clears any flashing effect. This method will be called in startFlashing() and stopFlashing().
      • getAnimator

        protected Animator getAnimator()
      • startFlashing

        public void startFlashing()
        Starts flashing.
      • stopFlashing

        public void stopFlashing()
        Stops flashing.
      • uninstall

        public void uninstall()
        Uninstalls the Flashable from the component. Once uninstalled, you have to create a new Flashable in order to use thflashingng feature again. If you just want to stop flashing, you should use stopFlashing().
      • isFlashing

        public boolean isFlashing()
        Checks if it is flashing.
        Returns:
        true if flashing.
      • isFlashableInstalled

        public static boolean isFlashableInstalled​(javax.swing.JComponent component)
        Checks if there is a Flashable installed on the component.
        Parameters:
        component - the component.
        Returns:
        true if installed.
      • getFlashable

        public static Flashable getFlashable​(javax.swing.JComponent component)
        Gets the TableFlashable installed on the table, if any.
        Parameters:
        component - the component.
        Returns:
        whether a Flashable is installed.