Shape for MultiPortNode

Ok… I changed the following in Demo1.java

void multiPortNodeAction() {
: : : :
MultiPortNode snode = new MultiPortNode();
JGoImage nodeicon = new JGoImage(new Rectangle(0,0,40,40));
nodeicon.loadImage(Demo1.class.getResource(“doc.gif”), true);
snode.initialize(loc, nodeicon, “multiport node”);
: : : :

to this…

JGoRoundRect nodeicon = new JGoRoundRect();
 nodeicon.setBrush(JGoBrush.makeStockBrush(new RGB(0,255,0)));
nodeicon.setPen(JGoPen.make(JGoPen.SOLID,1,JGoBrush.ColorDarkGray));

snode.initialize(loc, nodeicon, “multiport node”);

… but it doesn’t display the JGoRoundRect… what’s missing???

dWiGhT

I would guess that it’s because you didn’t specify a size.

soooooo… changing it to try out giving it a dimension:

JGoRoundRect nodeicon = new JGoRoundRect(new Dimension(100,200));
 nodeicon.setBrush(JGoBrush.makeStockBrush(new RGB(0,255,0)));
nodeicon.setPen(JGoPen.make(JGoPen.SOLID,1,JGoBrush.ColorDarkGray));
snode.initialize(loc, nodeicon, "multiport node");

results in the same non-existent shape drawn for the node. This is the only change that I made to Demo1, nothing else.

dWiGhT

That Dimension argument to the constructor specifies how rounded the corners are.

You probably meant to write:
JGoRoundRect nodeicon = new JGoRoundRect(new Rectangle(0, 0, 100,200), new Dimension(10, 10));

Oopsie, that was it. Thanks (yet again!)…

dWiGhT