Question
I'm supposed to have a program where a ball is bouncing around, with 4 buttons, two of them stops and resume the ball, the other
I'm supposed to have a program where a ball is bouncing around, with 4 buttons, two of them stops and resume the ball, the other two adds and remove balls to the panel, and a scroll bar that delays the movement of the balls. So far I have two buttons that stops and resume the ball movement, I also have the scroll bar that delays the movement of the ball. Now I need help on how to make the add and remove button work and add another ball to the panel, the only tip that I have is that I'm supposed to have an arraylist of colored balls. Also BallControl is the main panel where everything is
Ball is a panel where the ball moves around.
Now class Ball, a subclass of JPanel must paint multiple balls with random colors. This class should have a reference to a list of colored balls that should be represented in a separate class Class ColorBall represents a ball that is located at (xy), moves da horizontally and by dy vertically, and has a random color Ball, a subelass of JPanel, a list of colored balls with a timer. A Class Ball, a subclass of JPanel, represents a list of colored balls with a timer. All balls have the same radius, radius. The timer's delay time is 10 milliseconds by default. Every delay interval, the timer fires an action event, and each ball should move by dr horizontally and by dy vertically. The timer should be started automatically when the ball is created. Its delay can be changed via method setDelay. The timer is stopped in method suspend, and it is started again in method resume. A ball is not allowed to move out of boundary list: A array list of colored balls timer: A timer of a ball with a delay in milliseconds and an action listener radius: Radius of a ball Class BallControl needs two more buttons, +1 and button-1 button to increase and decrease the number of balls respectively, and burton-1 button to increase and decrease the mumber o alsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started