/** * 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); } }
/** * 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 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); } }