@Override
    public void actionPerformed(ActionEvent e) {
        JMenuItem action = (JMenuItem)e.getSource();
        switch (action.getText()) {
            case "Add Node":
                //int h = Integer.parseInt(JOptionPane.showInputDialog(this, "Height:", "Node Addition", JOptionPane.QUESTION_MESSAGE));
                Node n = new Node(this.clickedPoint.x, this.clickedPoint.y);
                //n.set_height(h);
                this.gr.add_node(n);
                this.repaint();
                break;
            /*case "Edit Height":
                int n_h = Integer.parseInt(JOptionPane.showInputDialog(this, "Height:", (Object)this.gr.get_node(this.clickedId).get_height()));
                this.gr.get_node(this.clickedId).set_height(n_h);
                this.repaint();
                break;*/
            case "Start edge":
                this.state = Mode.ADD_EDGE;
                break;
            case "Delete":
                this.gr.remove_node(this.clickedId);
                this.repaint();
                break;
            case "Set as source":
                this.source = this.clickedId;
                this.gr.set_source(this.gr.get_node(source));
                this.repaint();
                break;
            case "Set as sink":
                this.sink = this.clickedId;
                this.gr.set_sink(this.gr.get_node(sink));
                this.repaint();
                break;
            case "Remove":
                this.gr.remove_edge(this.clickedId);
                this.repaint();
                break;
            case "Edit capacity":
                int c;
                try {
                    c = Integer.parseInt(JOptionPane.showInputDialog(this, "Capacity:", (Object)this.gr.get_edge(this.clickedId).get_capacity()));
                    this.gr.get_edge(this.clickedId).set_capacity(c);
                } catch (Exception exc) {
                    JOptionPane.showMessageDialog(this, exc.getMessage(), "Entered capacity is not a number!", JOptionPane.ERROR_MESSAGE);
                }
                this.repaint();
                break;
        }
    }