@Override
	public Dimension preferredLayoutSize(Container parent) {
		int componentCount = parent.getComponentCount();
		int rowCount = (componentCount + (columnCount - 1)) / columnCount;
		Insets insets = parent.getInsets();
		Dimension d = new Dimension(0, 0);
		int totalComponentHeight = 0;
		for (int i = 0; i < rowCount; i++) {
			totalComponentHeight += getRowHeight(parent, i);
		}

		int totalColumns = Math.min(columnCount, componentCount);
		int totalComponentWidth = getPreferredColumnWidth(parent) * totalColumns;
		d.width = totalComponentWidth + hgap * (columnCount - 1) + insets.left + insets.right;
		d.height = totalComponentHeight + vgap * (rowCount - 1) + insets.top + insets.bottom;
		return d;
	}
Constructs a new PairLayout.
@param vgap the gap (in pixels) between rows.
@param hgap the gap (in pixels) between the two columns.
@param columnCount the number of columns in this grid
Ghidra/Framework/Gui/src/main/java/ghidra/util/layout/VariableRowHeightGridLayout.java