Question: Develop a GUI program as shown in Figure 29.2, with the following requirements: (1) The radius of each vertex is 20 pixels. (2) The user
Develop a GUI program as shown in Figure 29.2, with the following requirements: (1) The radius of each vertex is 20 pixels. (2) The user clicks the left mouse button to place a vertex centered at the mouse point, provided that the mouse point is not inside or too close to an existing vertex. (3) The user clicks the right mouse button inside an existing vertex to remove the vertex. (4) The user presses a mouse button inside a vertex and drags to another vertex and then releases the button to create an edge, and the distance between the two vertices is also displayed. (5) The user drags a vertex while pressing the CTRL key to move a vertex. (6) The vertices are numbers starting from 0. When a vertex is removed, the vertices are renumbered. (7) You can click the Show MST or Show All SP From the Source button to display an MST or SP tree from a starting vertex. (8) You can click the Show Shortest Path button to display the shortest path between the two specified vertices.
Step by Step Solution
3.47 Rating (160 Votes )
There are 3 Steps involved in it
Program Plan Create a class WeightedGraphTool that extends Application class Create one button to display the shortest path from the starting vertex to ending vertex given by the user Create second bu... View full answer
Get step-by-step solutions from verified subject matter experts
