PDA

View Full Version : Layout stretches width to 100%. How do you prevent it?



Payam
1 Jul 2008, 7:00 PM
Hey guys.

I have a layout container that is 600 px.
I then add a HorizontalPanel with 2 items (probably a total of 100px width).
I want to put a border around the Horizontal Panel, but I find that it is actually 600px width.

Using firebug, I found out that the HorizontalPanel's <div> tags, take up the entire space, but the Table itself is the proper size.
How can I make it so that the HorizontalPanel also becomes the exact size of the table.

Otherwise, putting a HorizontalPanel inside a CenterLayout does not work, since the HorizontalPanel takes up the entire width.
Eg. This doesn't work:


LayoutContainer center = new LayoutContainer(new CenterLayout());
HorizontalPanel horizontal = new HorizontalPanel();
horizontal.add(new Text("Hello"));
horizontal.add(new Text("Bye"));
center.add(horizontal);
this.add(center);


If I could somehow get rid of the <div> tags to be the actual size of the table (fixed width and height), problem solved. Anyone know how to do it?