2011-04-13 58 views
0

我正在使用Java的Line2D.Float。重新定位Line2D Java

我正试图完成某种形状的拖放。

我已经得到了选定的Line2D对象,我只需要弄清楚如何将它实际移动到新坐标。

我需要的是这样的:

(Line2D)selectedShape).setLocation(newX, newY);

selectedShape是一个形状对象,这就是为什么我添加了铸造

谢谢

回答

1

喜欢的东西this:。

void setLine(Point2D p1, Point2D p2) 

     Sets the location of the endpoints of this Line2D to the specified Point2D coordinates.