Question
Write a JavaFX program named RectangledCircles that enables the user to add and remove points in a two-dimensional plane dynamically. A minimum bounding rectangle is
Write a JavaFX program named RectangledCircles that enables the user to add and remove points in a two-dimensional plane dynamically. A minimum bounding rectangle is updated as the points are added and removed. Assume that the radius of each point is 10 pixels. Here is an algorithm for the mouse event triggered:
MousePressed event triggered
If Primary mouse button pressed
Create a new circle at the location pressed
Else if Secondary mouse button pressed
Get a list of all the circles on the screen
If current location pressed is inside (use contains method) a circle
Remove the circle
End if
End if
Get the X and Y coordinates of all the circle centers
Find the max and min of all X and Y values
Set the coordinates and length/width of the bounding rectangle according to the min and max values
End mousePressed event
Rectangled Circles INSTRUCTION Add: Left Click Remove: Right Click
Step 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