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.
class WorkflowStateNode extends JGoBasicNode {
public WorkflowStateNode() {
super (); &nb sp; &nb sp; &nb sp; &nb sp; &nb sp; &nb sp; &nb sp; initCommon();
void initCommon(){
setDrawable(new JGoRectangle());

// setBackground(rrect);
setInsets(new Insets(4, 10, 4, 10));
Thanks a lot.


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