View Full Version : how to make a container has the same dimensions as its parent?

31 May 2011, 7:13 AM
hi everybody
how to make a container has the same dimensions as its parent?
between "BorderLayout" and "fitLayout" which layout is best? or should I use a different layout?

31 May 2011, 8:16 AM
To paraphrase the API docs, this is a 'fit' layout:

This is a base class for layouts that contain a single item that automatically expands to fill the layout's container

And a 'border' layout:

This is a multi-pane, application-oriented UI layout style that supports multiple nested panels, automatic split bars between regions and built-in expanding and collapsing of regions.

If you're trying to build the initial layout for an app, I'd recommend going with a border layout, where you can declare a persistent header ('north' region), a persistent footer ('south' region'), and a 'center' region which dynamically expands to fill the remaining content area of the page (not to mention the optional 'west' and 'east' regions, where I typically use 'west' for a TreePanel/Navigation menu).

31 May 2011, 10:42 AM
thank you for your anwser.
mycentral region must contain a different set each time a button is clicked. my problem is how to dynamically display different panels one after the other in the central region?

31 May 2011, 11:37 AM
It sounds like you want a card layout on your center region. Check out the 'Card (Wizard)' demo here:


If card layout isn't what you want then the technique is still similar: add/remove the dynamic panels as children of the center region rather than trying to change the center region itself.

1 Jun 2011, 1:05 AM
thank you. using cardLayout was th solution. i'm able to do what i want with a cardLayout. it is very pratics!!!! thank you again!!