Package com.jidesoft.swing
Class Flashable
- java.lang.Object
-
- com.jidesoft.swing.Flashable
-
public abstract class Flashable extends java.lang.ObjectFlashableis a basic interface to enable flashing in any component. Internally it usesAnimatorto create the flashing effect. Whenever a Flashable is installed to a JComponent, you can always useisFlashableInstalled(javax.swing.JComponent)to check if it is installed.
-
-
Field Summary
Fields Modifier and Type Field Description protected Animator_animatorprotected javax.swing.JComponent_componentprotected javax.swing.Timer_timerstatic java.lang.StringCLIENT_PROPERTY_FLASHABLE
-
Constructor Summary
Constructors Constructor Description Flashable(javax.swing.JComponent component)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidclearFlashing()Clears any flashing effect.abstract voidflash()This method actually does the flashing.protected AnimatorgetAnimator()javax.swing.JComponentgetComponent()Gets the table that will flash.static FlashablegetFlashable(javax.swing.JComponent component)Gets the TableFlashable installed on the table, if any.intgetInterval()Gets the interval, in ms.static booleangetSynchronizedFlashFlag()Gets the flash flag.static booleanisFlashableInstalled(javax.swing.JComponent component)Checks if there is a Flashable installed on the component.booleanisFlashing()Checks if it is flashing.voidsetComponent(javax.swing.JComponent component)Sets the table that will flash.voidsetInterval(int interval)Sets the interval, in ms.voidstartFlashing()Starts flashing.voidstopFlashing()Stops flashing.voiduninstall()Uninstalls theFlashablefrom the component.
-
-
-
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
-
-
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 instartFlashing()andstopFlashing().
-
getAnimator
protected Animator getAnimator()
-
startFlashing
public void startFlashing()
Starts flashing.
-
stopFlashing
public void stopFlashing()
Stops flashing.
-
uninstall
public void uninstall()
Uninstalls theFlashablefrom 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 usestopFlashing().
-
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.
-
-