PanelHeader panelHeader = (PanelHeader)getComponent();
Button.DataRenderer dataRenderer = panelHeader.getDataRenderer();
dataRenderer.render(panelHeader.getButtonData(), panelHeader, false);
Dimensions preferredContentSize = dataRenderer.getPreferredSize();
int preferredWidth = preferredContentSize.width
+ buttonPadding.left + buttonPadding.right + 2;
int preferredHeight = preferredContentSize.height
+ buttonPadding.top + buttonPadding.bottom + 2;
return new Dimensions(preferredWidth, preferredHeight);
}