Attaches this TPoint to another so it follows it. @param p the point to attach to @return true if a change has occurred
(TPoint p)
| 324 | * @return true if a change has occurred |
| 325 | */ |
| 326 | public boolean attachTo(TPoint p) { |
| 327 | if (p == null || p == this) |
| 328 | return false; |
| 329 | if (p == attachedTo && p.x == x && p.y == y) |
| 330 | return false; |
| 331 | // detach this from any previous point |
| 332 | detach(); |
| 333 | // attach by adding property change listener |
| 334 | attachedTo = p; |
| 335 | p.addPropertyChangeListener("location", new Follower()); //$NON-NLS-1$ |
| 336 | setXY(p.x, p.y); |
| 337 | return true; |
| 338 | } |
| 339 | |
| 340 | /** |
| 341 | * Detaches this TPoint. |
nothing calls this directly
no test coverage detected