Question: need help java Square Rebound For this lab, you'll build on the Dots.java and DotsPanel.java programs. Instead of drawing dots you will draw squares so

need help java

Square Rebound

For this lab, you'll build on the Dots.java and DotsPanel.java programs.

Instead of drawing dots you will draw squares so add that change.

Add animation using a Timer so that the squares all move when drawn. Make each square move at random speed (in x and y directions), and have the squares "bounce" appropriately off all four sides of the screen.

HINTS:

Create 2 arrays of size 1000 to hold random values between 1 and 10 for the X movements and Y movements. This will allow your rectangles to have independent movement speeds.

You will need to create a ActionListener class similar to what is used in ReboundPanel class.

Inside the Actionistener class you create you will want to reference the X and Y array indexes rather than the static moveX and moveY used in the ReboundPanel.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!