Need help in PolylineConnection [message #168642] |
Thu, 17 February 2005 10:37 |
Eclipse User |
|
|
|
Originally posted by: pengfai.hotmail.com
hi...i encounter problem like below:
Once i add the polylineConnection between two nodes,
the nodes's location are relocated out of order and the conneciton line
not linked each others.
However,the nodes are well located if i comment out the "add connection
command". The same problem when i try with BorderLayout. Is that the
layout itself mess up or PolylineConnection matter?
Of course, the XYLayout will give the desire result.
// customize layout
public void layout(IFigure parent)
{ Rectangle area = parent.getClientArea();
List children = parent.getChildren();
IFigure child;
centralNode(parent);
for (int i=0;i<children.size();i++)
{ child = (IFigure)children.get(i);
Rectangle rect = new Rectangle();
if (child.equals(center))
{continue;}
else if(child!=center && child.isVisible()){
rect.x =(int)(center.getBounds().x +
radius*(Math.cos(i*getAngle(parent)))) rect.y
=(int)(center.getBounds().y+radius*(Math.sin(i*getAngle(pare nt))));
area.x = rect.x;
area.y = rect.y;
}
child.setBounds(area);
}
}
PolylineConnection c1 = new PolylineConnection();
ChopboxAnchor sourceAnchor1 = new ChopboxAnchor(node1);
ChopboxAnchor targetAnchor1 = new ChopboxAnchor(node2);
c1.setSourceAnchor(sourceAnchor1);
c1.setTargetAnchor(targetAnchor1);
panel.add(c1); // problems when invoke
thanks in advance..
|
|
|
Powered by
FUDForum. Page generated in 0.03934 seconds