/** * Finds a handle at the given coordinates. * * @return the hit handle, null if no handle is found. */ public Handle findHandle(int x, int y) { Handle handle; HandleEnumeration he = selectionHandles(); while (he.hasNextHandle()) { handle = he.nextHandle(); if (handle.containsPoint(x, y)) { return handle; } } return null; }
/** Gets an enumeration of the currently active handles. */ protected HandleEnumeration selectionHandles() { if (fSelectionHandles == null) { fSelectionHandles = CollectionsFactory.current().createList(); FigureEnumeration fe = selection(); while (fe.hasNextFigure()) { Figure figure = fe.nextFigure(); HandleEnumeration kk = figure.handles(); while (kk.hasNextHandle()) { fSelectionHandles.add(kk.nextHandle()); } } } return new HandleEnumerator(fSelectionHandles); }
/** Draws the currently active handles. */ public void drawHandles(Graphics g) { HandleEnumeration he = selectionHandles(); while (he.hasNextHandle()) { (he.nextHandle()).draw(g); } }