Here you can find the source of retargetMouseEvent(int id, MouseEvent e, Component target)
public static void retargetMouseEvent(int id, MouseEvent e, Component target)
//package com.java2s; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Main { public static void retargetMouseEvent(int id, MouseEvent e, Component target) {/*from w w w. j av a 2s . c o m*/ if (target == null || (target == e.getSource() && id == e.getID())) { return; } if (e.isConsumed()) { return; } // fix for bug #4202966 -- hania // When re-targeting a mouse event, we need to translate // the event's coordinates relative to the target. Point p = SwingUtilities.convertPoint((Component) e.getSource(), e.getX(), e.getY(), target); MouseEvent retargeted = new MouseEvent(target, id, e.getWhen(), e.getModifiersEx() | e.getModifiers(), p.x, p.y, e.getClickCount(), e.isPopupTrigger(), e.getButton()); target.dispatchEvent(retargeted); } }