Create JGraph Cell

DefaultGraphCell cell = new DefaultGraphCell(name);
GraphConstants.setBorderColor(cell.getAttributes(), Color.black);
GraphConstants.setBounds(cell.getAttributes(), new Rectangle2D.Double(posx, posy, 100, 20));
DefaultPort port = new DefaultPort();
cell.add(port);
graph.getGraphLayoutCache().insert(cell);

source

Leave a Reply