double mouseX = MouseInfo.getPointerInfo().getLocation().getX(); double mouseY = MouseInfo.getPointerInfo().getLocation().getY();