All Packages Class Hierarchy This Package Previous Next Index
Class user.signal.Signal
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----user.signal.Signal
- public class Signal
- extends Canvas
- implements Runnable
This class is used to display a signal light including border. It can
be set to the colors: wait color, alert color, go color and light off
color. Also the blinking of the signal can be turned on and off.
-
ALERT_COLOR
- Set the color used at the alert signal.
-
GO_COLOR
- Set the color used at the go (save) signal.
-
WAIT_COLOR
- Set the color used at the wait signal.
-
Signal(Color, BlinkChecker, int, int, int)
- Constructor.
-
destroy()
-
-
paint(Graphics)
- Paint the signal.
-
run()
- This function implements the
run()
method used in
the load blink thread.
-
setBlinking(boolean)
-
-
setLightColor(Color)
- Set the color of the signal light and repaint it.
-
start()
-
-
stop()
-
-
update(Graphics)
- Update the graphics.
WAIT_COLOR
public static final Color WAIT_COLOR
- Set the color used at the wait signal.
ALERT_COLOR
public static final Color ALERT_COLOR
- Set the color used at the alert signal.
GO_COLOR
public static final Color GO_COLOR
- Set the color used at the go (save) signal.
Signal
public Signal(Color light_color,
BlinkChecker blink_checker,
int blink_time,
int signal_border,
int light_border)
- Constructor.
- Parameters:
- light_color - The initial color of the signal light.
- blink_checker - The interface which should check if an
off signal should be painted.
- blink_time - The blinking time [ms].
- signal_border - The border around the signal.
- light_border - The border around the signal light.
setBlinking
public void setBlinking(boolean do_blink)
start
public void start()
stop
public void stop()
destroy
public void destroy()
run
public void run()
- This function implements the
run()
method used in
the load blink thread. It shows a blinking alert signal when the
loading of the net data is sufficient fast. Jump from this method
when a QuitException
has been thrown by the blinking
thread. It will be thrown when the thread should stop.
setLightColor
public void setLightColor(Color light_color)
- Set the color of the signal light and repaint it. The repaint is
only done when the color is changed and the signal was already
painted. The setting of the light color is synchronised with the
blink thread.
- Parameters:
- light_color - The new color of the the light.
update
public void update(Graphics g)
- Update the graphics. This can be done directly with a
complete paint() of the signal without a clear, because
double buffering is used.
- Parameters:
- g - The graphical context.
- Overrides:
- update in class Component
paint
public void paint(Graphics g)
- Paint the signal. Double buffering is used to prevend flicker.
The color of the signal to paint is retrieved in a synchronised
way between the various threads.
- Parameters:
- g - The graphical context.
- Overrides:
- paint in class Canvas
All Packages Class Hierarchy This Package Previous Next Index