PDA

View Full Version : ContentPanel Minimum Size



dpcowx
30 Nov 2008, 9:34 PM
Hi guys,

How do create a content panel that takes the minimum (calculated) size of it's children? To this point, I've always been setting an explicit width/height for a content panel. This is a real paint and I'd prefer to not do this as it makes string localization a pain (e.g. will things fit and look good when I switch to German, etc). It seems that whenever I don't explicitly specify a height or width, or even when I use -1 to the setWidth() function, the content panel seems to still take up 100% when it's the only widget on the page.

What I'm looking for is a way to get the content panel to dynamically adjust it's size to be the minimum size needed for it's contents rather than having to hardcode something like cp.setWidth(300);

How can I do this?

Thanks,
Daniel

kolli
1 Dec 2008, 6:03 AM
cannot you try using a layout and not set the width explicitly. A flow layout or a fit layout would work as the contentPanel will get the size of children in this case.

LINEMAN78
1 Dec 2008, 11:55 AM
try
cp.setAutoWidth(true);