Draw2D PolylineConnection [message #226815] |
Thu, 23 November 2006 16:52 |
Eclipse User |
|
|
|
Originally posted by: ben00ze.gmail.com
Sorry for have posted this thread in the wrong newsgroup, I hope it's the
right one now.
Hi all,
I have a question about PolyLineConnection
I made a class named SystemeFigure in which I can added some kind of
Rectangle.
In the class named SystemeFigure, I added a MouseMotion listener which
allow me to move the RectangleSysteme selected and this works well.
But I also tried to add a PolyLineConnection when a button is enabled.
public class SystemeFigure extends Figure {
.....
new MouseMotionListener() {
.....
public void mouseDragged(MouseEvent me) {
if ( me.getSource() instanceof RectangleSysteme){
((RectangleSysteme)me.getSource()).setLocation(me.getLocatio n());
}
}
}
new MouseListener() {
public void mousePressed(MouseEvent me) {
PolylineConnection c = new PolylineConnection();
ChopboxAnchor sourceAnchor = new ChopboxAnchor(source);
ChopboxAnchor targetAnchor = new
ChopboxAnchor(((RectangleSysteme)me.getSource()));
c.setSourceAnchor(sourceAnchor);
c.setTargetAnchor(targetAnchor);
add(c);
}
}
private class RectangleSysteme extends RectangleFigure
{
.....
public void setLocation(Point p)
{
super.setLocation(p);
.... // some stuff to do
}
}
But when I add the PolyLineConnection, my RectangleSysteme go to their
first position, and it's impossible to move them again.
Someone can help me please ?
ps : sorry for my english
|
|
|
|
Powered by
FUDForum. Page generated in 0.02996 seconds