I\'ve been using JUNG to visualize some simple graphs, and I\'d like to write several of them to a PNG file. Unfortunately, the images often appear to render before the graph is
You can also use VisualizationImageServer. It's a subtype of BasicVisualizationServer which adds a getImage method. I have had no trouble with it rendering the graphs properly.
Your code would then be like:
public void writeImage(String filename) {
Layout layout = new CircleLayout(jungGraph);
layout.setSize(innerSize);
bvs = new VisualizationImageServer(layout);
// [...]
BufferedImage image = (BufferedImage)bvs.getImage();
}