Henry Wong wrote:
It isn't very hard code to figure out -- in fact, it is incredibly easy. And figuring out another's code is a common task all developers do. Care to take a shot at it, and tell us how you think it works first?
Henry
I figured out that by default the ball object moves by (1,1), however, when the ball reaches the enclosing bounds (of type Rectangle2D), the sign is reversed so that the sign of x and y are changed. This is done so when the dx or dy exceeds the bounds the ball switches to the opposing bound. For example, if x is becoming -5 then it becomes +5, so that the ball position starts from (5, y). I just needed a confirmation.