|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.Timer PIRL.Viewers.Blinker
public class Blinker
An ActionListener for blinking a component to make it stand out from the crowd.
Blinking occurs by setting the background color of the component to a specified color, and then returning to the original color, with a delay interval between background color switching. This on-off cycle is repeated for a specified number of times, or until instructed to stop. An optional delay after the new background color is first switched on until the blinking intervals start may be specified.
Field Summary | |
---|---|
static Color |
COLOR
The default background Color to use when the component is blinked "on": yellow. |
static int |
INDEFINITELY
Constant to specify an indefinate number of blinks; i.e. forever until stopped. |
static int |
INITIAL_DELAY
The default initial delay before blinking starts: 0 milliseconds (immediately after start). |
static int |
INTERVAL
The default blink interval: 500 milliseconds (half a second). |
static int |
MINIMUM_INTERVAL
The minimum blink interval: 100 milliseconds. |
static int |
REPEATS
The default number of blink repeats: INDEFINITELY. |
Fields inherited from class javax.swing.Timer |
---|
listenerList |
Constructor Summary | |
---|---|
Blinker()
Constructs a disabled Blinker with default Blinker parameters. |
|
Blinker(Component component)
Constructs a Blinker for the component using all of the default Blinker parameters. |
|
Blinker(Component component,
Color color,
int repeats,
int initial_delay,
int interval)
Constructs a component Blinker. |
Method Summary | |
---|---|
void |
actionPerformed(ActionEvent event)
Performs the blink event at the Timer interval. |
Color |
getColor()
Gets the background color that will be used when blinking the component. |
Component |
getComponent()
Gets the Component to be blinked. |
int |
getRepeats()
Gets the maximum number of blinks. |
void |
restart()
Restarts the Blinker as if no blinks had occured. |
Color |
setColor(Color color)
Sets the background color to use when blinking the component. |
Blinker |
setComponent(Component component)
Sets the Component to be blinked. |
int |
setRepeats(int repeats)
Sets the maximum number of blinks. |
void |
start()
Turns the component "on" (sets the new background color) and starts the blink timer. |
void |
stop()
Stops the blink timer and turns the component "off" (sets the original background color). |
Methods inherited from class javax.swing.Timer |
---|
addActionListener, fireActionPerformed, getActionCommand, getActionListeners, getDelay, getInitialDelay, getListeners, getLogTimers, isCoalesce, isRepeats, isRunning, removeActionListener, setActionCommand, setCoalesce, setDelay, setInitialDelay, setLogTimers, setRepeats |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int INDEFINITELY
public static final int REPEATS
public static final int INITIAL_DELAY
public static final int INTERVAL
public static final int MINIMUM_INTERVAL
public static final Color COLOR
Constructor Detail |
---|
public Blinker(Component component, Color color, int repeats, int initial_delay, int interval)
component
- The Component to be blinked.color
- The Color to set the component background when
it is blinked "on".repeats
- The maximum number of blinks. Use the INDEFINITELY
value to continue blinking until
stopped.initial_delay
- The initial delay, after the component
is turned on, before starting to blink. A value <= 0 means
no initial delay.interval
- The interval between blinks (on to off, or
off to on). A MINIMUM_INTERVAL
is enforced.public Blinker(Component component)
component
- The Component to be blinked.public Blinker()
Method Detail |
---|
public void start()
start
in class Timer
public void stop()
stop
in class Timer
public void restart()
restart
in class Timer
public int setRepeats(int repeats)
repeats
- The maximum number of times to blink the component.
Use the INDEFINITELY
value to continue
blinking until stopped.
public int getRepeats()
INDEFINITELY
value.public Color setColor(Color color)
color
- The background color when the component is "on".
public Color getColor()
public Blinker setComponent(Component component)
Any currently blinking component is stopped and the blink count is reset to zero. The new component will not yet be blinking.
component
- The Component to be blinked.
public Component getComponent()
public void actionPerformed(ActionEvent event)
actionPerformed
in interface ActionListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |