ฟังการคลิกเมาส์ทั้งระบบ (ไม่ใช่บน JFrame เป็นต้น)

public void mouseClicked(MouseEvent e) {
    JTable target = (JTable)e.getSource();
    //get the coordinates of the mouse click
    Point p = e.getPoint();
    //get the row index that contains that coordinate
    row= target.rowAtPoint(p);
}
package mouseclickevent;
import java.awt.AWTEvent;
import java.awt.Component;
import java.awt.EventQueue;
import java.awt.MenuComponent;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import java.awt.event.MouseEvent;
import java.lang.reflect.Method;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;


public class FrmEvent extends JFrame {
    public FrmEvent(){
        JPanel panel = new JPanel();
        getContentPane().add(panel);
        JButton btn = new JButton("Test");
        panel.add(btn);
        panel.add(new JTextField("Test"));
        btn.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                FrmEvent frm = new FrmEvent();
                frm.setBounds(300,300,  200, 200);
                frm.show();

            }
        });

    }

    private void consumeEvents() {
        try {
            if (Thread.currentThread().getClass().getName().endsWith(
            "EventDispatchThread")) {
                EventQueue eq = null;
                eq = Toolkit.getDefaultToolkit().getSystemEventQueue();

                if (eq == null) {
                    return;
                }
                while (isVisible() || isShowing()) {
                    AWTEvent event = eq.getNextEvent();
                    Object src = event.getSource();
                    Class kActiveEvent= Class.forName("java.awt.ActiveEvent");
                    if (kActiveEvent != null) {
                        if (kActiveEvent.isInstance(event)) {
                            Method m;
                            Class types[] = {};
                            Object args[] = {};
                            m = kActiveEvent.getMethod("dispatch",  types);

                            if (m != null) {
                                m.invoke(event, args);
                                continue;
                            }
                        }
                    }
                    dispatchEvent(src, event);
                }
            }

        }
        catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }
    private  void dispatchEvent(Object src, AWTEvent event) {
        if (event.getID()== MouseEvent.MOUSE_CLICKED) {
            System.out.println("mouseClicked");
        }
        if (src instanceof Component) {
            ( (Component) src).dispatchEvent(event);
        } else if (src instanceof MenuComponent) {
            ( (MenuComponent) src).dispatchEvent(event);
        }
    }

    public void show(){
        super.show();
        consumeEvents();
    }

    public static void main(String[] args) {

        FrmEvent frm = new FrmEvent();
        frm.setBounds(300,300,  200, 200);
        frm.show();

    }
}