2011-04-13 29 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.