[Bluej-discuss] Help

Kelly Liu kelgene at gmail.com
Fri Oct 6 03:06:19 BST 2006


Hello, my name is Lily.
Is anyone could help me how to do the ex5.55?

public void boxBounce( int balls )
{  // this is how I draw the rectangle
   Dimension d = myCanvas.getSize();
   int w = (int) d.getWidth();
   int h = (int) d.getHeight();

   Rectangle rect2 = new Rectangle( 20, 20, w-40, 200 );
   myCanvas.setForegroundColor(Color.yellow );
   myCanvas.draw(rect2);

   ArrayList list = new ArrayList( balls ); //This is how i create the array
for the ball
}

I can't finished the rest, how do I create the new class for the BoxBall? Am
I just copy the BounceBall class to the BoxBall? How do I make the ball
bounce off the wall of the rectangle?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.bluej.org/pipermail/bluej-discuss/attachments/20061006/63ff17d1/attachment.html


More information about the bluej-discuss mailing list