Draw an object that moves horizontally and vertically.
§ The object should have a width 1/10 of the size of the window and the height should be 1/10 of the size of the window.
§ The initial position of the object should be x=50, and y=50
§ The initial shape of the object is a ball.
Draw a different object depending upon a mouse press:
§ The first time the mouse button is pressed the object to be drawn is a box.
§ The next time the mouse button is pressed the object to be drawn is a ball.
Set different colors for the ball or box as follows:
§ If the object is in the upper-left quadrant of the output window, the color is red.
§ If the object is in the upper-right quadrant of the output window, the color is green.
§ If the object is in the lower-left quadrant of the output window, the color is blue.
§ If the object is in the lower-right quadrant of the output window, the color is black.
Direction of object:
§ When the edge of the object hits any side of the screen, the object should reverse direction.
Use a variable of type boolean in the code that controls the shape of the object; the first time the mouse button is clicked, the object changes to a box. The next time the mouse button is clicked, the object returns to a ball; this functionality continues to reverse each time the mouse button is clicked; update the value of the boolean variable in the mousePressed() method.