GUI - HilaShoshan/ObjectOriented_Task2 GitHub Wiki
This class contains methods that can paint a graph to the screen, using StdDraw class and JFrame.
You van choose three options:
**1. graph: **
save - choose a name and save the graph as a file.
load - init a saved graph from a file.
show graph - to draw the graph: the black circles represents the nodes, and the numbers on it: the keys. there is an arrow from source to dest where exists dirrected edge. the weights of the edges are represented as a number on the edge, closer to dest node.
**2. algorithms: **
All the optional algorithms to do on the graph.
**3. add / remove: **
Enable add / remove node or edge from the graph.
- public Graph_GUI() - init a new graph_gui.
- private void drawGraph()- this function Rebooting the entire drawing window. This function drawing all the vertexs and edges on the screen.
- private String likeString(List<node_data> path)- return string of all the vertex in our graph.
- private void paintPath(List<node_data> path, double minX, double maxX, double maxY)- paint the way (edges) between src vertex and dest vertex.
- private void init()- creating menuBar on the drawing window. Its show the options that you can do on the graph, like: show the graph, save and load the graph to a file, show if connected + the shortes path between 2 vertex, add + remove vertex/edge from the graph.
- public void actionPerformed(ActionEvent e)- The function pops up a window - and asks the user to write down what they want to do (depending on the activity they chose - the previous function).