@Override protected void handlePress(MouseEvent e) { super.handlePress(e); DrawingItem item = getItem(); DragHandle handle = getHandle(); if (handle != null && item != null) { int index = (Integer) handle.getData(); Double p = item.getPoints().get(Math.abs(index - 1)); // opposite is the anchor anchor = new Double(p.getX(), p.getY()); } }
@Override protected void handleRelease(MouseEvent e) { super.handleRelease(e); anchor = null; }