JGoBasicNode.setInsets

Hi,

Calling JGoBasicNode.setInsets(new Insets(10, 10, 10, 10)) doesn’t seem
to have any effect. I have the label to the right and it still sticks
to the node.

Regards,

Werner.

The insets are only used by layoutChildren when getLabelSpot() == JGoObject.Center. Otherwise the label isn’t inside the drawable shape, so there wouldn’t be any “content” to be inset.
We ought to fix the documentation there. Sorry about the confusion.
To increase the space between the JGoDrawable shape and the JGoText label, you might override layoutChildren to do something like:
public void layoutChildren(JGoObject childchanged) {
if (isInitializing()) return;
JGoDrawable shape = getDrawable();
if (shape == null) return;
JGoText label = getLabel();
if (label != null) {
// assume getLabelSpot() == RightCenter !!!
Rectangle b = shape.getBoundingRect();
label.setTopLeft(b.x + b.width + 3, b.y + b.height/2);
}
if (getPort() != null) {
getPort().setSpotLocation(Center, shape, Center);
}
}
Note that this assumes the LabelSpot is RightCenter; it also assumes a spacing of 3.

Thanks again Walter. It works fine.

Regards,

Werner.