/BouncingBallJava

A Java Program of Object Oriented Programming

Primary LanguageJava

BouncingBallJava

A Java Program of Object Oriented Programming

This Program is created with Java to Strengthen the Concept of OOP

The Program itself Consist of 4 Classes which are :

  1. Ball :

This Class contains the attributes of each balls, the attributes are Speed, Coordinates Radius, and Color. This class also contains Collide Function/Method of the ball with the frame, and also the ball to another ball.

  1. Ball Area :

This class contains the frame area, initialize the height, width and color of the area and also the draw function to render the background

  1. Ball Panel :

This class consisted of the Refresh rate of the ball and the array to store each ball. Also implementing action listener to initialize a new ball everytime space key is pressed. This class cosntructor is the one which called a new ball, and last the function to start the thread as the ball started to bounce. I also added a random function to generate new color everytime a new ball is initialized

  1. Main :

This class is used to initialize Frame using Java Swing JFrame, and to compile the whole code to create the beautifull screen saver of multiple bouncing ball