/** * Starts flashing. */ public void startFlashing() { clearFlashing(); getAnimator().start(); }
public void animationFrame(Component component, int totalStep, int step) { flash(); }
public Flashable(JComponent component) { _component = component; install(_component); }
/** * Uninstalls the <code>Flashable</code> 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 {@link * #stopFlashing()}. */ public void uninstall() { stopFlashing(); _animator.dispose(); _animator = null; getComponent().putClientProperty(CLIENT_PROPERTY_FLASHABLE, null); }
/** * Checks if it is flashing. * * @return true if flashing. */ public boolean isFlashing() { return getAnimator().isRunning(); }
private void install(JComponent component) { _animator = new Animator(component, 0, getInterval(), -1) { @Override protected Timer createTimer(int delay, ActionListener listener) {
/** * Sets the interval, in ms. If the flashing is running, the new interval will take effect immediately. By default, * it is 300 ms. * * @param interval the new interval. */ public void setInterval(int interval) { int old = _interval; if (old != interval) { _interval = interval; getAnimator().setDelay(interval); } }
/** * Stops flashing. */ public void stopFlashing() { clearFlashing(); getAnimator().stop(); }