private void fireMouseMoveEvent(MouseEvent e) { for (MouseMotionListener l : mMouseMotionListeners) { if (e.getID() == MouseEvent.MOUSE_MOVED) { l.mouseMoved(e); } else if (e.getID() == MouseEvent.MOUSE_DRAGGED) { l.mouseDragged(e); } } }
@Override public void mouseMoved(MouseEvent e) { if (mouseEnabled || e instanceof BotEvent) { for (MouseMotionListener l : defaultMouseMotionListeners) { l.mouseMoved(e); } mousePoint = e.getPoint(); mouseOnCanvas = true; } }
protected void processMouseMotionEvent(MouseEvent e) { MouseEvent transformedEvent = transformMouseEvent(e); if (mouseEnteredComponent == null) { mouseEnteredComponent = mouseCurrentComponent; } switch (e.getID()) { case MouseEvent.MOUSE_MOVED: if (mouseCurrentComponent != mouseEnteredComponent) { dispatchMouseEvent( createEnterExitEvent(mouseEnteredComponent, MouseEvent.MOUSE_EXITED, e)); dispatchMouseEvent( createEnterExitEvent(mouseCurrentComponent, MouseEvent.MOUSE_ENTERED, e)); } break; case MouseEvent.MOUSE_DRAGGED: if (mouseDraggedComponent == null) { mouseDraggedComponent = mouseEnteredComponent; } if (mouseEnteredComponent == mouseDraggedComponent && mouseCurrentComponent != mouseDraggedComponent) { dispatchMouseEvent( createEnterExitEvent(mouseDraggedComponent, MouseEvent.MOUSE_EXITED, e)); } else if (mouseEnteredComponent != mouseDraggedComponent && mouseCurrentComponent == mouseDraggedComponent) { dispatchMouseEvent( createEnterExitEvent(mouseDraggedComponent, MouseEvent.MOUSE_ENTERED, e)); } if (mouseDraggedComponent != null) { transformedEvent.setSource(mouseDraggedComponent); } break; } mouseEnteredComponent = mouseCurrentComponent; // dispatch MouseMotionEvent MouseMotionListener[] mouseMotionListeners = transformedEvent.getComponent().getMouseMotionListeners(); for (MouseMotionListener listener : mouseMotionListeners) { // skip all ToolTipManager's related listeners if (!listener.getClass().getName().startsWith("javax.swing.ToolTipManager")) { switch (transformedEvent.getID()) { case MouseEvent.MOUSE_MOVED: listener.mouseMoved(transformedEvent); break; case MouseEvent.MOUSE_DRAGGED: listener.mouseDragged(transformedEvent); break; default: throw new AssertionError(); } } } super.processMouseMotionEvent(e); }
protected void installMouseMotionHook() { MouseMotionListener[] listeners = header.getMouseMotionListeners(); for (int i = 0; i < listeners.length; i++) { MouseMotionListener l = listeners[i]; if (l.getClass().getName().contains("TableHeaderUI")) { this.mouseMotionDelegate = l; listeners[i] = this; } header.removeMouseMotionListener(l); } for (MouseMotionListener l : listeners) { header.addMouseMotionListener(l); } }
/** * Implemented to pass the event to the original only if the mouseX doesn't lead to dragging the * column over the first. */ @Override public void mouseDragged(MouseEvent e) { TableColumn dragged = header.getDraggedColumn(); // int index = getViewIndexForColumn(header.getColumnModel(), dragged); // dragged column is at second position, allow only drags to the right int indexColumn = header.getColumnModel().getColumnIndex(columnName); if (indexColumn == 1) { if (e.getX() < maxX) return; } mouseMotionDelegate.mouseDragged(e); }
public void mouseMoved(LayerEvent e) { if (_filter.accept(e)) { _mml.mouseMoved(e); } }
@Override public void mouseMoved(MouseEvent e) { mouseMotionDelegate.mouseMoved(e); }
public void mouseMoved(MouseEvent e) { for (MouseMotionListener ml : mouseMotionListeners) { ml.mouseMoved(translate(e)); } }
/** * Handles the mouseMoved event by invoking the mouseMoved methods on listener-a and listener-b. * * @param e the mouse event */ public void mouseMoved(MouseEvent e) { ((MouseMotionListener) a).mouseMoved(e); ((MouseMotionListener) b).mouseMoved(e); }