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.


Variable Index

 o ALERT_COLOR
Set the color used at the alert signal.
 o GO_COLOR
Set the color used at the go (save) signal.
 o WAIT_COLOR
Set the color used at the wait signal.

Constructor Index

 o Signal(Color, BlinkChecker, int, int, int)
Constructor.

Method Index

 o destroy()
 o paint(Graphics)
Paint the signal.
 o run()
This function implements the run() method used in the load blink thread.
 o setBlinking(boolean)
 o setLightColor(Color)
Set the color of the signal light and repaint it.
 o start()
 o stop()
 o update(Graphics)
Update the graphics.

Variables

 o WAIT_COLOR
 public static final Color WAIT_COLOR
Set the color used at the wait signal.

 o ALERT_COLOR
 public static final Color ALERT_COLOR
Set the color used at the alert signal.

 o GO_COLOR
 public static final Color GO_COLOR
Set the color used at the go (save) signal.

Constructors

 o 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.

Methods

 o setBlinking
 public void setBlinking(boolean do_blink)
 o start
 public void start()
 o stop
 public void stop()
 o destroy
 public void destroy()
 o 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.

 o 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.
 o 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
 o 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