/** * Sets the node types - this maps a background color/gradient to each type. * * @param types */ public void setTypes(Collection<? extends Object> types) { setNodeTypes(types); }
public MainFrame() { super("Baby Shrimp Test"); SampleGraphModel model = new SampleGraphModel(); this.graph = new FlatGraph(model); // color the nodes based on node type DefaultGraphNodeStyle nodeStyle = new DefaultGraphNodeStyle(); nodeStyle.setNodeTypes(model.getNodeTypes()); this.graph.setGraphNodeStyle(nodeStyle); // color the arcs based on arc type DefaultGraphArcStyle arcStyle = new DefaultGraphArcStyle(); arcStyle.setArcTypes(model.getArcTypes()); this.graph.setGraphArcStyle(arcStyle); initialize(); // run the initial layout on the nodes //SwingUtilities.invokeLater(new Runnable() { // public void run() { // try { // Thread.sleep(100); // } catch (InterruptedException e) { // } // graph.performLayout(); //} //}); }
nodeStyle.setNodeTypes(model.getNodeTypes()); this.graph.setGraphNodeStyle(nodeStyle);