|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectBall
A small ball object that wanders randomly around a bounded area. CSE143 lecture demo Au01, Sp03
Constructor Summary | |
Ball(int x,
int y,
int dx,
int dy,
Color c,
int diameter,
int maxx,
int maxy)
Construct a new Ball |
Method Summary | |
void |
action()
Perform an appropriate action on each cycle of the simulation |
void |
paintComponent(Graphics g)
Display this ball on the given graphics context |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Ball(int x, int y, int dx, int dy, Color c, int diameter, int maxx, int maxy)
x
- initial x pixel coordinate of center of the bally
- initial y pixel coordinate of center of the balldx
- initial velocity in x direction in pixels per cycledy
- initial velocity in y direction in pixels per cyclec
- color of the balldiameter
- diameter of the ball in pixelsmaxx
- largest possible x coordinatemaxy
- largest possible y coordinateMethod Detail |
public void action()
action
in interface SimThing
public void paintComponent(Graphics g)
paintComponent
in interface SimThing
g
- the graphics context where this ball should be drawn
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |