MidpointLocator problem [message #177568] |
Thu, 14 April 2005 11:47  |
Eclipse User |
|
|
|
Hi all,
These codes shows a label in the middle of a connection:
Label label=new Label();
label.setText("test");
conn.add(label,new MidpointLocator(conn, 0));
But replace them with following code, nothing is in the middle(expecting an
triangle):
conn.add(new PolygonDecoration(),new MidpointLocator(conn, 0));
why?
Regards
Hao
|
|
|
|
|
|
Re: MidpointLocator problem [message #177774 is a reply to message #177766] |
Thu, 14 April 2005 21:26  |
Eclipse User |
|
|
|
Problem solved using following subclass of MidpointLocator, thanks.
class MyMidpointLocator extends MidpointLocator {
public MyMidpointLocator(Connection c, int i) {
super(c, i);
}
public void relocate(IFigure target) {
PointList points = getConnection().getPoints();
RotatableDecoration arrow = (RotatableDecoration) target;
arrow.setLocation(getLocation(points));
arrow.setReferencePoint(points.getPoint(getIndex()));
}
}
"Hao Zhang" <bjzhanghao@21cn.com> д
|
|
|
Powered by
FUDForum. Page generated in 0.04023 seconds