refreshing the view

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

refreshing the view

Michał Urban
ello I've created graph using JGraphT library
g = new ListenableUndirectedWeightedGraph <String, MyEdge>(MyEdge.class);
        graphAdapter = new JGraphXAdapter<String, MyEdge>(g);

        layout = new mxOrganicLayout(graphAdapter);
        layout.execute(graphAdapter.getDefaultParent());

        mxGraphComponent component = new mxGraphComponent(graphAdapter);

        component.setPreferredSize(new Dimension(dim.width - 50, dim.height - 200));

        add(component);

and I want to add dynamically a new vertex after pushing the button

@Override public void actionPerformed(ActionEvent e) { String a="1"; String b="2";
        g.addVertex(a);
        g.addVertex(b);
        g.addEdge(a,b); } public static class MyEdge extends DefaultWeightedEdge { //weight @Override public String toString() { return String.valueOf(getWeight()); } }

how can I refresh the view?


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
jgrapht-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jgrapht-users
Loading...