[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: Problems with moving Label/Figure in Connection

Funny I should come across this - I was just working on exactly the same 
problem.
I'm not sure a ConnectionLocator is what you want to use...I found that 
MidpointLocator works and will locate the label in the middle of the 
connection line. Of course, I could be wrong :(

"Jack" <pengfai81@xxxxxxxxxxxxxx> wrote in message 
news:cnf3n6$agh$1@xxxxxxxxxxxxxxxxxx
> Hi , all..
> I have created a connection between two figures. What can i do to move the 
> label along the conn in "every certain distance"?
>
> Here is portion of the code:
>
>        PolylineConnection conn = new PolylineConnection();
>        ChopboxAnchor sourceAnchor = new ChopboxAnchor(nodeFigure1); 
> ChopboxAnchor targetAnchor = new ChopboxAnchor(nodeFigure2);
>        conn.setSourceAnchor(sourceAnchor);
>        conn.setTargetAnchor(targetAnchor);
>
>        Label label = new Label("  ");
> label.setOpaque(true);
> label.setBackgroundColor(ColorConstants.blue);
> label.setVisible(true);
>        // just display the label located at source
>        conn.add(label, new ConnectionLocator(conn,2));
>
> Thanks in advance....
>
>