public boolean isInside(int x1, int y1, int x2, int y2)
    {
        int tmp = x1;
        if (x2 < x1) {
            x1 = x2;
            x2 = tmp;
        }
        tmp = y1;
        if (y2 < y1) {
            y1 = y2;
            y2 = tmp;
        }
        return (x1 < x && x < x2) && (y1 < y && y < y2)
            && (x1 < x+width && x+width < x2) && (y1 < y+height && y+height < y2);
    }