Droped node with a big green rectangle


In my WorkflowStateNode, if I add the following feateature to my node : setDrawable(new JGoRectangle()). It will affect the behavior of drag and drop between JgoPalette and JgoView. When I drag a node from JgoPalette to Jgoview, the node will have a enlarged green rectangle around it. The location of the rectangle seems start from the up-left corner of the jgoview. How this happen, and why?
The reason for me to put the line code in the initCommon() is that I want the shape of the basicNode to be Rectangle, not oval.
If I take setDrawable(new JGoRectangle()) away from initCommon(), everythings works perfectly. But the shape of the node becomes oval.
public
class WorkflowStateNode extends JGoBasicNode {
public WorkflowStateNode() {
super (); &nb sp; &nb sp; &nb sp; &nb sp; &nb sp; &nb sp; &nb sp; initCommon();
}
private
void initCommon(){
setLabelSpot(JGoObject.Center);
setDrawable(new JGoRectangle());
setBrush(JGoBrush.makeStockBrush(Color.white));

// setBackground(rrect);
setInsets(new Insets(4, 10, 4, 10));
setResizable(false);
setAutoResize(false);
}
}
Thanks a lot.
Li

It’s better to override createDrawable to do what you want. Take a look at the definition in JGoBasicNode.java.