private boolean validateCoordinates(MouseEvent e) {
        Point location = getLocation();
        Dimension size = getSize();
        if (e.getX() < location.getX() || e.getX() > location.getX() + size.getWidth()) {
            return false;
        }
        if (e.getY() < location.getY() || e.getY() > location.getY() + size.getHeight()) {
            return false;
        }
        return true;
    }