Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Arrow.SetOrigin throws exception (Read 3095 times)
koosala
Full Member
***
Offline


Java Happens

Posts: 136
Joined: May 13th, 2007
Arrow.SetOrigin throws exception
Jun 19th, 2007 at 3:56am
Print Post  
Hi,

I was trying the following lines to first create two boxes and then create an arrow. Then set the origin of the arrow to the first box

Box box = new Box(flowchart);
box.setBounds(new Rectangle2D.Float(100, 100, 100, 100));
flowchart.add(box);

Box box2 = new Box(flowchart);
box2.setBounds(new Rectangle2D.Float(300, 300, 100, 100));
flowchart.add(box2);

Arrow test = new Arrow(flowchart);
test.setOrigin(box);

It threw an exception

java.lang.NullPointerException
at com.mindfusion.jdiagram.Link.b(Unknown Source)
at com.mindfusion.jdiagram.Arrow.setOrigin(Unknown Source)
at OrgChartTest.init(OrgChartTest.java:71)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


I know both the origin and destination nodes can be specified in the constructor of the arrow itself, but I want to be able to dynamically link arrows around, even during its creation.

So, a bug?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow.SetOrigin throws exception
Reply #1 - Jun 19th, 2007 at 5:21am
Print Post  
Hi,

Try using the Arrow(Point2D, Point2D) constructor to create an unconnected arrow. setOrigin should work fine after that.

Stoyan
  
Back to top
 
IP Logged
 
koosala
Full Member
***
Offline


Java Happens

Posts: 136
Joined: May 13th, 2007
Re: Arrow.SetOrigin throws exception
Reply #2 - Jun 19th, 2007 at 7:20am
Print Post  
Works, thank you.

But is there a reason the other mechanism didn't work?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow.SetOrigin throws exception
Reply #3 - Jun 19th, 2007 at 9:43am
Print Post  
That constructor is supposedly used only when drawing arrows interactively, but I don't know why it is public.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint