/** * Called to process events. Mouse events will be rewritten to indicate the position in the * document clicked, instead of the position of the panel. * * @param event to process. */ protected void processEvent(AWTEvent event) { try { if (event instanceof MouseEvent) { final Point scrollPosition = getScrollPosition(); if (scrollPosition != null) { final MouseEvent mouseEvent = (MouseEvent) event; event = new MouseEvent( (Component) mouseEvent.getSource(), mouseEvent.getID(), mouseEvent.getWhen(), mouseEvent.getModifiers(), mouseEvent.getX() + scrollPosition.x, mouseEvent.getY() + scrollPosition.y, mouseEvent.getClickCount(), mouseEvent.isPopupTrigger()); } } } catch (final Throwable exp) { exp.printStackTrace(DjVuOptions.err); System.gc(); } super.processEvent(event); }
public void mouseDragged(MouseEvent e) { mDrag(e.getX(), e.getY()); }