/** Handles mouse down events. The event is delegated to the currently active tool. */ public void mousePressed(MouseEvent e) { try { requestFocus(); // JDK1.1 Point p = constrainPoint(new Point(e.getX(), e.getY())); setLastClick(new Point(e.getX(), e.getY())); tool().mouseDown(e, p.x, p.y); checkDamage(); } catch (Throwable t) { handleMouseEventException(t); } }
/** * Hook method which can be overriden by subclasses to provide specialised behaviour in the event * of a popup trigger. */ protected void handlePopupMenu(MouseEvent e, int x, int y) { Figure figure = drawing().findFigure(e.getX(), e.getY()); if (figure != null) { Object attribute = figure.getAttribute(Figure.POPUP_MENU); if (attribute == null) { figure = drawing().findFigureInside(e.getX(), e.getY()); } if (figure != null) { showPopupMenu(figure, e.getX(), e.getY(), e.getComponent()); } } }
/** Handles mouse move events. The event is delegated to the currently active tool. */ public void mouseMoved(MouseEvent e) { try { tool().mouseMove(e, e.getX(), e.getY()); } catch (Throwable t) { handleMouseEventException(t); } }
/** Handles mouse drag events. The event is delegated to the currently active tool. */ public void mouseDragged(MouseEvent e) { try { Point p = constrainPoint(new Point(e.getX(), e.getY())); tool().mouseDrag(e, p.x, p.y); checkDamage(); } catch (Throwable t) { handleMouseEventException(t); } }