重新定位Line2D Java

时间:2011-04-13 16:25:12

标签: java drag-and-drop line

我正在使用Java的Line2D.Float。

我正试图为这种形状做一些拖拽。

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

我需要这样的东西:

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

selectedShape是一个Shape对象,这就是我添加转换的原因。

谢谢。

1 个答案:

答案 0 :(得分:1)

this

 void   setLine(Point2D p1, Point2D p2)

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