r2.x = rect.x + border.left; r2.width = rect.width - border.left - border.right; r2.y = rect.y + border.top; r2.height = rect.height - border.top - border.bottom;
r2.x = rect.x + ((sides & LEFT) == 0 ? 0 :border.left); r2.width = rect.width - ((sides & LEFT) == 0 ? 0 :border.left) - ((sides & RIGHT) == 0 ? 0 :border.right); r2.y = rect.y + ((sides & TOP) == 0 ? 0 :border.top); r2.height = rect.height - ((sides & TOP) == 0 ? 0 :border.top) - ((sides & BOTTOM) == 0 ? 0 :border.bottom);
    public static Rectangle shrinkRect(final Rectangle rect, final Border border) {        Rectangle r2 = new Rectangle();        r2.x = rect.x + border.left;        r2.width = rect.width - border.left - border.right;        r2.y = rect.y + border.top;        r2.height = rect.height - border.top - border.bottom;        return r2;    }