A我自己写的connection连线算法Connection————5



/**
* 鼠标释放
*/
public void mouseReleased(MouseEvent e) {
System.out.println("鼠标释放: " + e.getSource().getClass().getName());

// 第二次鼠标释放产生连接线
if (clickNumber == 1 && conn1 == null) {
conn = new PolylineConnection();
conn.setForegroundColor(ColorConstants.yellow);
conn.setConnectionRouter(new ChipConnectionRouter(chipTrough));
conn.setSourceAnchor(new ChopboxAnchor(sourceRole));
conn.setTargetAnchor(new ChopboxAnchor((Role) e.getSource()));
conn.setTargetDecoration(new PolygonDecoration());
// conn.setConnectionRouter(new
// ShortestPathConnectionRouter(
// chipTrough));
panel.add(conn);
roleLost = null;
conn1 = new PolylineConnection();
// panel.remove(conn1);
clickNumber = 0;
}

// 鼠标释放坐标
Point p = e.getLocation();
// last = p;
// 获得你鼠标释放的figure
if (clickFrigure == 1) {
Dimension delta = p.getDifference(chipLast);
ChipFont f = (ChipFont) e.getSource();

你可能感兴趣的:(算法,F#)