Result (final JComponent component, final GridConstraints constraints) { final Result result = new Result(component); int endRow = constraints.getRow() + constraints.getRowSpan()-1; myLastRow = Math.max(myLastRow, endRow); int endCol = constraints.getColumn() + constraints.getColSpan()-1; myLastCol = Math.max(myLastCol, endCol); int indent = Util.DEFAULT_INDENT * constraints.getIndent(); constraintsToGridBag(constraints, result.constraints); result.constraints.weightx = getWeight(constraints, true); result.constraints.weighty = getWeight(constraints, false); result.constraints.insets = new Insets(myInsets.top, myInsets.left + indent, myInsets.bottom, myInsets.right); Dimension minSize = constraints.myMinimumSize; if (component != null && minSize.width <= 0 && minSize.height <= 0) { minSize = component.getMinimumSize(); } if ((constraints.getHSizePolicy() & GridConstraints.SIZEPOLICY_CAN_SHRINK) == 0) { minSize.width = constraints.myPreferredSize.width > 0 || component == null ? constraints.myPreferredSize.width : component.getPreferredSize().width; } if ((constraints.getVSizePolicy() & GridConstraints.SIZEPOLICY_CAN_SHRINK) == 0) { minSize.height = constraints.myPreferredSize.height > 0 || component == null ? constraints.myPreferredSize.height : component.getPreferredSize().height; } if (minSize.width != -1 || minSize.height != -1) { result.minimumSize = minSize; } if (constraints.myPreferredSize.width > 0 && constraints.myPreferredSize.height > 0) { result.preferredSize = constraints.myPreferredSize; } if (constraints.myMaximumSize.width > 0 && constraints.myMaximumSize.height > 0) { result.maximumSize = constraints.myMaximumSize; } return result; }