All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class crw.device.CarrierMover

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----crw.device.CarrierMover

public class CarrierMover
extends Canvas
implements Runnable
This class implements the CarrierInPipe class in a canvas,
which finally fulfills the "moving carriers in a pipe".
It implements Runnable. The thread should be started manually.

Version:
0.2 3/29/1999
Author:
Hongyu Lu
See Also:
CarrierInPipe

Constructor Index

 o CarrierMover()
Creates a Pipe with default values.
width=80, height=30, densityLevel=4 Orientation='East'.
 o CarrierMover(int, int, int, char)
Creates a Pipe with some of the default values.
 o CarrierMover(int, int, int, int, int, char, boolean, Color, boolean)
Creates a Pipe.

Method Index

 o paint(Graphics)
Draws pipe of carriers in the canvas.
 o run()
 o setDotsNumber(int)
Sets the carrier densityLevel in the pipe.
 o setHeight(int)
Sets the height of the pipe.
 o setOrientation(char)
Sets the orientation of the pipe.
 o setType(boolean)
Sets the carrier type in the pipe,
 o setXInit(int)
Sets x of the pipe.
 o setYInit(int)
Sets y of the pipe.
 o start()
Starts the animation, which should be called manually.
 o stop()
Stops the animation, which should be called manually.
 o update(Graphics)

Constructors

 o CarrierMover
 public CarrierMover()
Creates a Pipe with default values.
width=80, height=30, densityLevel=4 Orientation='East'.

 o CarrierMover
 public CarrierMover(int width,
                     int height,
                     int dotsNumber,
                     char orientation)
Creates a Pipe with some of the default values.

Parameters:
width - pipe width
height - pipe height
dotsNumber - densityLevel max=1, min=50
orientation - pipe orientation
 o CarrierMover
 public CarrierMover(int xInit,
                     int yInit,
                     int width,
                     int height,
                     int dotsNumber,
                     char orientation,
                     boolean isElectron,
                     Color background,
                     boolean withBorder)
Creates a Pipe.

Parameters:
xInit - x of pipe
yInit - y of pipe
width - pipe width
height - pipe height
dotsNumber - densityLevel max=1, min=50
orientation - pipe orientation
isElectron - carrier type
background - background color
withBorder - if drawing pipe with borders

Methods

 o update
 public void update(Graphics g)
Overrides:
update in class Component
 o paint
 public void paint(Graphics g)
Draws pipe of carriers in the canvas.

Parameters:
g - the graphics context
Overrides:
paint in class Canvas
 o start
 public void start()
Starts the animation, which should be called manually.

 o stop
 public void stop()
Stops the animation, which should be called manually.

 o run
 public void run()
 o setHeight
 public void setHeight(int height)
Sets the height of the pipe.

Parameters:
height - new pipe height
 o setXInit
 public void setXInit(int xInit)
Sets x of the pipe.

Parameters:
xInit - new x of the pipe
 o setYInit
 public void setYInit(int yInit)
Sets y of the pipe.

Parameters:
yInit - new y of the pipe
 o setType
 public void setType(boolean isElectron)
Sets the carrier type in the pipe,

Parameters:
isElectron - new carrier type
 o setDotsNumber
 public void setDotsNumber(int dotsNumber)
Sets the carrier densityLevel in the pipe.

Parameters:
dotsNumber - new carrier densityLevel
 o setOrientation
 public void setOrientation(char orientation)
Sets the orientation of the pipe.

Parameters:
orientation - new orientation of the pipe

All Packages  Class Hierarchy  This Package  Previous  Next  Index