Question: Create an application that provides a solution for problem 23.11 (using Swing GUI API) by modifying the solution implemented from the BouncingBall.doc file (located in

Create an application that provides a solution for problem 23.11 (using Swing GUI API) by modifying the solution implemented from the BouncingBall.doc file (located in the "Project 6/Bouncing Ball Original Solution"). The modifications are as follows for the new solution.

Remove the "Runnable" interface from "BouncingBallPanel" class.

Add the "Runnable" interface to "Ball" class

Modify the "mouseClicked" method in the "BouncingBallPanel"class to start the thread after each ball is created. The "Ball" class must receive a reference to the "Bouncing BallPanel" (i.e., to call the "repaint" method)

Remove the "run" method from the "BouncingBallpanel" note. The "run" method must be implemented in the "Ball" class. The inner loop of the "run" method must be removed and the single "move" method call should remain. Also modify the method so that the delay for each ball is different (i.e., a way to simulate ball moving at different rates)

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!