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

Write a JavaFX program named RectangledCircles that enables the user to add

Rectangled Circles INSTRUCTION Add: Left Click Remove: Right Click

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!