/** * Stops the current marquee selection. */ public void mouseReleased(MouseEvent e) { try { if (e != null && marqueeBounds != null) { if (!(e.getSource() instanceof JGraph)) throw new IllegalArgumentException("MarqueeHandler cannot " + "handle event from unknown source: " + e); JGraph graph = (JGraph) e.getSource(); Rectangle2D bounds = graph .fromScreen((Rectangle2D) marqueeBounds.clone()); handleMarqueeEvent(e, graph, bounds); graph.setCursor(previousCursor); Rectangle dirty = new Rectangle((int) marqueeBounds.getX(), (int) marqueeBounds.getY(), (int) marqueeBounds .getWidth() + 1, (int) marqueeBounds .getHeight() + 1); dirty.width++; dirty.height++; graph.repaint(dirty); } } finally { currentPoint = null; startPoint = null; marqueeBounds = null; previousCursor = null; } }