[jgrapht-users] Exporting JGraphT graphs to PNG via JGraph
Brought to you by:
barak_naveh,
perfecthash
From: Dimitri P. <dim...@gm...> - 2004-01-14 21:23:20
|
Hi! I'm trying to export a JGraphT-created JGraph to a file using the following piece of code: import org.jgraph.pad.GPConverter; import org.jgraph.pad.GPGraph; ... GPGraph gpGraph=3Dnull; BufferedImage img =3D null; ... gpGraph=3Dnew GPGraph(graph.getModel()); img =3D GPConverter.toImage(gpGraph); try { ImageIO.write(img, "png", new File(selectedFileName)); } catch (IOException exception) { this.logger.error("", exception); } graph is a JGraph, which was created from JGraphT. The code above works fine for JGraphs, which were created without JGraphT. With JGraphT, it produces an empty (white) PNG image. How can I export a JGraphT-JGraph to some common image format (PNG or JPG)? TIA dap=20 |