JGoiconicnode bounding rectangle color

Hi all!
I have 2 questions…
1 - Is there a way to paint interior of the bounding rectangle of a JGoIconicNode with a custom color?

2 - Is there a way to paint the edge of the bounding rectangle?

Thanks in advance

You can change the background color and/or boundary of any JGoDrawable by setting the Pen and Brush properties, but the JGoIconicNode class does not contain any such background JGoDrawable object. You just need to create a JGoIconicNode subclass that adds one.

The following very simple subclass should get you started:
public class IconicNode extends JGoIconicNode {
public IconicNode() {
}
public IconicNode(String label) {
super(label);
init();
}
private void init() {
myRect = new JGoRectangle();
myRect.setSize(100, 100);
addObjectAtHead(myRect);
layoutChildren(null);
}
public void layoutChildren(JGoObject childchanged) {
if (isInitializing())
return;
if ((myRect != null) && (getIcon() != null))
getIcon().setSpotLocation(Center, myRect, Center);
super.layoutChildren(childchanged);
}
protected void copyChildren(JGoArea newarea, JGoCopyEnvironment env) {
super.copyChildren(newarea, env);
IconicNode newobj = (IconicNode) newarea;
newobj.myRect = (JGoRectangle) env.get(myRect);
}
public JGoRectangle getRect() {
return myRect;
}
private JGoRectangle myRect = null;
}
Worst case, you can always override the paint method in the node and paint the outlined/filled rectangle, then call the super's paint method to paint the normal node on top of that. It's actually not that much code.
I'm using that to paint a translucent selection rectangle around the icon part of the iconic node.