1int x = MouseInfo.getPointerInfo().getLocation().x;
2int y = MouseInfo.getPointerInfo().getLocation().y;
1implement MouseListener
2
3@Override
4public void mouseClicked(MouseEvent e) {
5 int x=e.getX();
6 int y=e.getY();
7 System.out.println(x+","+y);//these co-ords are relative to the component
8}