Problem with JGoView.pick-Methods


#1

I have some code like:



nodeicon1.loadImage("c://s3-logo.gif ", true);

SimpleNode node1 = new SimpleNode();

node1.initialize(new Point(50,50),

new Dimension(89,89),

nodeicon,

“test”,

true,

true);

doc.addObjectAtTail(node1);



JGoImage nodeicon1 = new JGoImage(new Rectangle(0,0,89,89));

nodeicon1.loadImage("c://s3-logo.gif ", true);

SimpleNode node2 = new SimpleNode();

node2.initialize(new Point(250, 50),

new Dimension(89, 89),

nodeicon1,

“test”,

true,

true);

doc.addObjectAtTail(node2);



When I say



pvf.jGoView1.newLink(node1.getOutput Port(), node2.getInputPort());



this works correctly.

This code



pvf.jGoView1.newLink(pvf.jGoView1.pi ckNearestPort(new Point(140,95)),

pvf.jGoView1.pickNearestPort(n ew Point(250,95)));



does not. This code



SimpleNode obj1 = (SimpleNode) pvf.jGoView1.pickObject(new Point(140,95), false);

SimpleNode obj2 = (SimpleNode) pvf.jGoView1.pickObject(new Point(250,95), false);

pvf.jGoView1.newLink(obj1.getOutputP ort(), obj2.getInputPort());



doesn’t work, too.



Any suggestions?


#2

In the last case, you probably meant to call JGoView.pickDocObject, not pickObject which just picks view objects.