How to add labels to connection [message #209371] |
Tue, 14 February 2006 07:16 |
Eclipse User |
|
|
|
Originally posted by: rupesh_wakde.yahoo.com
hello
I am starting out with GEF,can anybody tell me how to add labels to the
connection.
thanks in advance
|
|
|
|
|
Re: How to add labels to connection [message #209513 is a reply to message #209371] |
Wed, 15 February 2006 17:32 |
Eclipse User |
|
|
|
Originally posted by: dutz.c-ware.de
This is the code I used and it works nicely. Jope it helps
package de.cware.qpe.editors.incidence.view.figure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.MidpointLocator;
import org.eclipse.draw2d.PolygonDecoration;
import org.eclipse.draw2d.PolylineConnection;
public class LabeledConnectionFigure extends PolylineConnection {
protected Label label;
public LabeledConnectionFigure() {
setTargetDecoration(new PolygonDecoration());
MidpointLocator labelLocator = new MidpointLocator(this, 0);
label = new Label("1");
label.setOpaque(true);
add(label, labelLocator);
}
public void setLabelText(String labelText) {
label.setText(labelText);
}
public String getLabelText() {
return label.getText();
}
}
Chris
"rupesh" <rupesh_wakde@yahoo.com> schrieb im Newsbeitrag
news:38682afaabba616098873e78934678e9$1@www.eclipse.org...
> hello
>
> I am starting out with GEF,can anybody tell me how to add labels to the
> connection.
>
> thanks in advance
>
|
|
|
Powered by
FUDForum. Page generated in 0.03475 seconds