Here you can find the source of parentMouseEvent(JComponent c, MouseEvent m)
Parameter | Description |
---|---|
c | relative component |
m | mopuse event |
public static MouseEvent parentMouseEvent(JComponent c, MouseEvent m)
//package com.java2s; //License from project: Apache License import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Main { /**//from www . j a v a2s.c om * build a moue event on the parent coordinates * * @param c relative component * @param m mopuse event * @return non-null new mouse event */ public static MouseEvent parentMouseEvent(JComponent c, MouseEvent m) { Point loc = c.getLocation(); int x = m.getX() + loc.x; int y = m.getY() + loc.y; MouseEvent ret = new MouseEvent(c.getParent(), m.getID(), m.getWhen(), m.getModifiers(), x, y, m.getClickCount(), m.isPopupTrigger(), m.getButton()); return ret; } }