I am trying to make the graph root node appear always in the middle
- why / 3 instead of / 2 ?
I call the following API to resize the graph.
Dimension dispSize = getCanvas().getSize();
Rectangle docbounds = getDocument().computeBounds();
double newscale = 1;
if (docbounds.width > 0 && docbounds.height > 0)
newscale = Math.min((dispSize.width / (double)docbounds.width), (dispSize.height / (double)docbounds.height));
if (newscale > 1)
newscale = 1;
The root node y position needs to be less than half the height of the
Call JGoView.setViewPosition to scroll it as far as you want.
Can you explain to me the difference between view and document?
Is there a demo for JGoOverview?
/** JGoView is a lightweight Swing JComponent that supports the display and editing of graphical objects such as nodes and links. JGoView supports the model-view-controller paradigm. JGoDocument is the model for JGoView. The primary purpose of JGoView is to display a JGoDocument and its JGoObjects. You can use the default JGoDocument that is created for the default JGoView constructor, or you can supply your own, either at construction or later. A JGoView is just a regular Swing JComponent. The part of a JGoView that shows the document is called the canvas. A view can also have scroll bars. A view can have a border, but the canvas does not support one. JGoView also supports the display of its own view-specific objects. Thus each view on the same document can have its own set of JGoObjects. These view objects will appear in front of all document objects. The most common example of view object is a selection handle (JGoHandle). **/