I am working with the JUNG libraries to create graphs in Java. I need to fit a graph to its parent frame and set the view so that the graph is shown in the center of the view.
I have managed to set the zoom to the correct size using code from here: How to manually set the zoom on a Jung visualisation? however the shrunken graph remains in the same place. I have also written a function to move the graph using code from here: How to programatically pan a VisualizationViewer with Jung (the java library)?.
The problem remains how do I work out how much the graph needs to be panned from its current location to center in the view. How can I find the current location of the graph?
Thanks