Dimension spDim = new Dimension(
viewportSize.width + ins.left + ins.right + scrollBarWidth,
viewportSize.height + ins.top + ins.bottom + ((header != null) ? header.getPreferredSize().height : 0));
if (!(sp.isMinimumSizeSet() && spDim.equals(sp.getMinimumSize()))) {
sp.setMinimumSize(spDim);
sp.revalidate();
}
}
else {
// The array field is not parented onto a scroll pane, set the minimum size to allow
// proper layout to occur.