Question: Create a class called Circle // IN JAVA CODE A Circle object knows, at least, its center coordinates and its radius. The Circle object should
-
Create a class called Circle // IN JAVA CODE
- A Circle object knows, at least, its center coordinates and its radius.
- The Circle object should have a draw(Graphic) method that takes a Graphic object as an argument and uses that Graphic object to draw itself.
- The JPanel paintComponent() method should call the draw method for each Circle object
- Have each Circle pick a random number for its radius
- You can also (this is an option) have each Circle object pick its own color.
-
Have each click of the mouse produce a Circle object
- Make sure each Circle object is remembered (in an array or ArrayList or ...)
-
Tracking Mouse Movement
- Provide RadioButtons to determine the behavior of your program. Have a RadioButton for the drawing of Circles as described above
- Have another RadioButton set to track the Mouse movement and connect the dots
- you might want to have a reset JButton for both applications that erases the drawing area when clicked
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
