Java Swing Mouse passBehind(MouseEvent e)

Here you can find the source of passBehind(MouseEvent e)

Description

Pass the event behind.

License

Open Source License

Parameter

Parameter Description
e the mouse released event

Declaration

static void passBehind(MouseEvent e) 

Method Source Code


//package com.java2s;
import java.awt.Container;

import java.awt.Point;
import java.awt.event.MouseEvent;

import javax.swing.JComponent;

import javax.swing.SwingUtilities;

public class Main {
    /**//from w  w  w .  j a va 2 s  .com
     * <p>
     * Pass the event behind.
     * </p>
     *
     * @param e
     *            the mouse released event
     */
    static void passBehind(MouseEvent e) {
        JComponent source = (JComponent) e.getSource();
        Container parent = source.getParent();
        if (parent != null) {
            Point pos = SwingUtilities.convertPoint(source, e.getPoint(), parent);
            MouseEvent event = new MouseEvent(parent, e.getID(), e.getWhen(), e.getModifiers(), pos.x, pos.y,
                    e.getClickCount(), e.isPopupTrigger());
            parent.dispatchEvent(event);
        }
    }
}

Related

  1. isPrimaryMouseButton(MouseEvent e)
  2. makeMouseOverBorder(final JComponent b)
  3. mapDragOperationFromModifiers(MouseEvent me, TransferHandler th)
  4. paintBandTitle(Graphics g, Rectangle titleRectangle, String title, boolean isUnderMouse, boolean hasExpandIcon)
  5. parentMouseEvent(JComponent c, MouseEvent m)
  6. propagate(MouseEvent e, Component c)
  7. removeMouseListenerToHierarchy(JComponent c, MouseListener listener)
  8. removePopup(JComponent mouseEvtComp)
  9. retargetMouseEvent(int id, MouseEvent e, Component target)