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
-
CarrierMover()
-
Creates a Pipe with default values.
width=80, height=30, densityLevel=4 Orientation='East'.
-
CarrierMover(int, int, int, char)
-
Creates a Pipe with some of the default values.
-
CarrierMover(int, int, int, int, int, char, boolean, Color, boolean)
-
Creates a Pipe.
-
paint(Graphics)
-
Draws pipe of carriers in the canvas.
-
run()
-
-
setDotsNumber(int)
-
Sets the carrier densityLevel in the pipe.
-
setHeight(int)
-
Sets the height of the pipe.
-
setOrientation(char)
-
Sets the orientation of the pipe.
-
setType(boolean)
-
Sets the carrier type in the pipe,
-
setXInit(int)
-
Sets x of the pipe.
-
setYInit(int)
-
Sets y of the pipe.
-
start()
-
Starts the animation, which should be called manually.
-
stop()
-
Stops the animation, which should be called manually.
-
update(Graphics)
-
CarrierMover
public CarrierMover()
- Creates a Pipe with default values.
width=80, height=30, densityLevel=4 Orientation='East'.
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
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
update
public void update(Graphics g)
- Overrides:
- update in class Component
paint
public void paint(Graphics g)
- Draws pipe of carriers in the canvas.
- Parameters:
- g - the graphics context
- Overrides:
- paint in class Canvas
start
public void start()
- Starts the animation, which should be called manually.
stop
public void stop()
- Stops the animation, which should be called manually.
run
public void run()
setHeight
public void setHeight(int height)
- Sets the height of the pipe.
- Parameters:
- height - new pipe height
setXInit
public void setXInit(int xInit)
- Sets x of the pipe.
- Parameters:
- xInit - new x of the pipe
setYInit
public void setYInit(int yInit)
- Sets y of the pipe.
- Parameters:
- yInit - new y of the pipe
setType
public void setType(boolean isElectron)
- Sets the carrier type in the pipe,
- Parameters:
- isElectron - new carrier type
setDotsNumber
public void setDotsNumber(int dotsNumber)
- Sets the carrier densityLevel in the pipe.
- Parameters:
- dotsNumber - new carrier densityLevel
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