[jgrapht-users] changing JGraphModelAdapter attributMap per vertex
Brought to you by:
barak_naveh,
perfecthash
From: DIMAS K I R <syu...@in...> - 2005-11-19 11:41:31
|
hi. does anyone know how to change attributMap per vertices in JGraphModelAdapter? (i'm using JGraph for visualisizing) i have tried this line of code, but it didn't works.. it returned java.lang.NullPointerException ///////////////////// //create attribut map method public Map createTriggerVertexAttributeMap(){ Map map =3D new Hashtable(); // Make sure the cell is resized on insert GraphConstants.setResize(map, true); // Add a nice looking gradient background GraphConstants.setGradientColor(map, Color.red); // Add a Border Color Attribute to the Map GraphConstants.setBorderColor(map, Color.BLUE); // Add a White Background GraphConstants.setBackground(map, Color.yellow); // Make Vertex Opaque GraphConstants.setOpaque(map, true); GraphConstants.setBorder(map,new javax.swing.border.BevelBorder(0= )); GraphConstants.setAutoSize(map,true); GraphConstants.setIcon(map, new ImageIcon(getClass().getResource("/img/dbRootDiagrams.GIF"))); return map; } //graphUtama is ListenableDirectedWeightedGraph JGraphModelAdapter JGraphModel =3D new JGraphModelAdapter(graphUtama); jgraph =3D new JGraph( JGraphModel ); JGraphModel.createDefaultEdgeAttributes(graphUtama); JGraphModel.createDefaultVertexAttributes(); String inserted =3D new String("test"); graphUtama.addVertex(inserted); jgraph.getModel().getAttributes(inserted).applyMap(createTriggerVertexAtt= ributeMap()); ///////////////////////// thx before |