if (this.buttonPanel == null)
return;
this.buttonPanel.setPreferredSize(null);
Dimension prefIconPanelDim = this.buttonPanel.getPreferredSize();
// fix for issue 13 - respect the gaps and insets
BasicCommandButtonPanelUI panelUI = (BasicCommandButtonPanelUI) buttonPanel
.getUI();
int titlePanelCount = buttonPanel.isToShowGroupLabels() ? 1 : 0;
this.maxDimension = new Dimension(prefIconPanelDim.width, panelUI
.getPreferredHeight(this.maxVisibleButtonRows,
titlePanelCount));
this.setPreferredSize(null);
}