|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Ball
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,
java.awt.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(java.awt.Graphics g)
Display this ball on the given graphics context |
java.lang.String |
toString()
Return a String representation of this Ball |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Ball(int x, int y, int dx, int dy, java.awt.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(java.awt.Graphics g)
paintComponent
in interface SimThing
g
- the graphics context where this ball should be drawnpublic java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |