Hello,
I use a ConnectionWidget with a line width > 1 to connect two widgets. The
result is shown in the attached picture.
The problem is the overlapping connection into the widgets. The connection
should end at the border (beyond) of the widgets.
How can I achieve this representation ?
Regards,
Bernd
Here is the modified ConnectionDemo code I use to create the picture:
public static void main (String[] args) {
Scene scene = new Scene ();
LayerWidget mainLayer = new LayerWidget (scene);
scene.addChild(mainLayer);
ImageWidget first = new ImageWidget (scene);
first.setImage (Utilities.loadImage ("javaone/resources/a.png"));
first.setPreferredLocation(new Point (100, 100));
first.getActions().addAction(ActionFactory.createMoveAction ());
first.setBorder(BorderFactory.createLineBorder(Color.RED, 1));
mainLayer.addChild(first);
ImageWidget second = new ImageWidget (scene);
second.setImage (Utilities.loadImage ("javaone/resources/b.png"));
second.setPreferredLocation(new Point (300, 200));
second.getActions().addAction(ActionFactory.createMoveAction ());
second.setBorder(BorderFactory.createLineBorder(Color.RED, 3));
mainLayer.addChild(second);
LayerWidget connectionLayer = new LayerWidget (scene);
scene.addChild(connectionLayer);
ConnectionWidget connection = new ConnectionWidget (scene);
connection.setSourceAnchor(AnchorFactory.createCircularAnchor(first,
32));
connection.setTargetAnchor(AnchorFactory.createCircularAnchor(second,
32));
connection.setStroke(new BasicStroke(5));
connection.setForeground(Color.GREEN);
connectionLayer.addChild(connection);
SceneSupport.show (scene.createView ());
}