Package com.jidesoft.swing
Class Flashable
- java.lang.Object
-
- com.jidesoft.swing.Flashable
-
public abstract class Flashable extends java.lang.Object
Flashable
is a basic interface to enable flashing in any component. Internally it usesAnimator
to 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
_animator
protected javax.swing.JComponent
_component
protected javax.swing.Timer
_timer
static java.lang.String
CLIENT_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 void
clearFlashing()
Clears any flashing effect.abstract void
flash()
This method actually does the flashing.protected Animator
getAnimator()
javax.swing.JComponent
getComponent()
Gets the table that will flash.static Flashable
getFlashable(javax.swing.JComponent component)
Gets the TableFlashable installed on the table, if any.int
getInterval()
Gets the interval, in ms.static boolean
getSynchronizedFlashFlag()
Gets the flash flag.static boolean
isFlashableInstalled(javax.swing.JComponent component)
Checks if there is a Flashable installed on the component.boolean
isFlashing()
Checks if it is flashing.void
setComponent(javax.swing.JComponent component)
Sets the table that will flash.void
setInterval(int interval)
Sets the interval, in ms.void
startFlashing()
Starts flashing.void
stopFlashing()
Stops flashing.void
uninstall()
Uninstalls theFlashable
from 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 theFlashable
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 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.
-
-