Rectangle (ComponentDragObject dragObject, boolean ignoreWidth, boolean ignoreHeight, boolean spans) { Rectangle rc = getDragObjectDimensions(dragObject, spans); int w = ignoreWidth ? 1 : rc.width; int h = ignoreHeight ? 1 : rc.height; if (rc.x < 0 || rc.y < 0 || rc.y + h > getContainer().getGridRowCount() || rc.x + w > getContainer().getGridColumnCount()) { return null; } return new Rectangle(rc.x, rc.y, w - 1, h - 1); }