I'm using the JUNG framework, with the FRLayout. Like this:
layout = new FRLayout<String, Number>(graph);
preferredSize = new Dimension(600, 600);
final VisualizationModel<String, Number> visualizationModel =
new DefaultVisualizationModel<String, Number>(layout, preferredSize);
vv = new VisualizationViewer<String, Number>(visualizationModel, preferredSize);
I've placed this in a GraphZoomScrollPane. I can zoom in, zoom out, move the graph around until it looks just like I want it, but I would like it to be like that when I start my Swing application.
What I want exactly, is that the graph's PreferredSize dynamically adjusts based on the graph size, so that when I load large graphs, I don't have to zoom in a billion times before the vertices don't overlap anymore.
What doesn't fit in my panel should normally then "disappear" behind the scrollbars.