Ejemplo n.º 1
0
 /** 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);
   }
 }
Ejemplo n.º 2
0
 /** 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);
   }
 }
Ejemplo n.º 3
0
 /** 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);
   }
 }
 /**
  * MouseListener method for mouseUp events. Depending on the kind of event the appropriate hook
  * method is called (popupMenuUp for popup trigger, doubleMouseClick for a double click, and
  * mouseUp() and mouseClick() for normal mouse clicks).
  *
  * @param e MouseEvent which should be interpreted
  * @param x x coordinate of the MouseEvent
  * @param y y coordinate of the MouseEvent
  */
 public void mouseUp(MouseEvent e, int x, int y) {
   if (e.isPopupTrigger()) {
     handlePopupMenu(e, x, y);
   } else if (e.getClickCount() == 2) {
     handleMouseDoubleClick(e, x, y);
   } else {
     super.mouseUp(e, x, y);
     handleMouseUp(e, x, y);
     handleMouseClick(e, x, y);
   }
 }
 /**
  * MouseListener method for mouseDown events. If the popup trigger has been activated, then the
  * appropriate hook method is called.
  *
  * @param e MouseEvent which should be interpreted
  * @param x x coordinate of the MouseEvent
  * @param y y coordinate of the MouseEvent
  */
 public void mouseDown(MouseEvent e, int x, int y) {
   // isPopupTrigger() at mouseDown() is only notified at UNIX systems
   if (e.isPopupTrigger()) {
     handlePopupMenu(e, x, y);
   } else {
     super.mouseDown(e, x, y);
     handleMouseDown(e, x, y);
   }
 }
 /**
  * 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());
     }
   }
 }
 /**
  * MouseListener method for mouseDrag events. Usually, mouse drags are ignored for popup menus or
  * double clicks.
  *
  * @param e MouseEvent which should be interpreted
  * @param x x coordinate of the MouseEvent
  * @param y y coordinate of the MouseEvent
  */
 public void mouseDrag(MouseEvent e, int x, int y) {
   if (!e.isPopupTrigger()) {
     super.mouseDrag(e, x, y);
   }
 }