void (MouseEvent e, boolean pressed, boolean moved) { if (e.getSource() instanceof JEditorPane pane) { int pos = pane.viewToModel2D(e.getPoint()); if (pos >= 0) { HTMLDocument document = (HTMLDocument)pane.getDocument(); AttributeSet attributes = document.getCharacterElement(pos).getAttributes(); if (attributes.getAttribute(HTML.Tag.A) != null) { return; } } } for (Pair<Component, ?> p : myComponents) { Component component = p.first; Rectangle bounds; if (p.second instanceof Insets) { bounds = component.getBounds(); JBInsets.addTo(bounds, (Insets)p.second); } else { @SuppressWarnings("unchecked") Function<Component, Rectangle> fun = (Function<Component, Rectangle>)p.second; bounds = fun.apply(component); } if (bounds.contains(SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), component.getParent()))) { if (myLastComponent != null && myLastComponent != component) { mouseExited(e, myLastComponent); } myLastComponent = component; MouseEvent event = createEvent(e, component); if (moved) { for (MouseMotionListener listener : component.getMouseMotionListeners()) { listener.mouseMoved(event); } } else { for (MouseListener listener : component.getMouseListeners()) { if (pressed) { listener.mousePressed(event); } else { listener.mouseReleased(event); } } } e.getComponent().setCursor(component.getCursor()); return; } else if (component == myLastComponent) { myLastComponent = null; mouseExited(e, component); } } }