The easiest thing is to create the diagram and then rescale the view so that it fits. Call GoView.RescaleToFit.
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;
I have a JPanel panelA which contains a JGoView. I have another JPanel
If you called JGoView.setBackground and that didn’t have any effect, is that because you had set JGoDocument.setPaperColor to be non-null?
Actually, what I want is JGoView to be opaque. This way, the canvas/view color will be the same as the background of its container. How do I do this? I tried setting setOpaque(true) on the JGoView but I still see a white
JGoView is always opaque. Did you try calling JGoView.setBackground or JGoDocument.setPaperColor?