problems with Component Alignment

Hello,

after updating Vaadin 7 beta 3, I had some problems with setComponentAlignment in the following code

		
		HorizontalLayout content = new HorizontalLayout();
		content.setSizeFull();
		HorizontalLayout hl = new HorizontalLayout();
		hl.setWidth("100%");

		HorizontalLayout child = new HorizontalLayout();
		child.setSpacing(true);

		for (int i = 0; i < 3; i++) {
			Button button = new NativeButton();
			button.setIcon(new ThemeResource("../runo/favicon.ico"));
			button.setWidth("50px");
			button.setHeight("50px");
			child.addComponent(button);
		}

		hl.addComponent(child);
		hl.setComponentAlignment(child, Alignment.TOP_CENTER);

		content.addComponent(hl);

		addComponent(content);

anyone knows how do I align this HorizontalLayout in the middle?

Thank you for the help.
Murilo

I am very very new to Vaadin but I believe I read that if your component is sized 100% then the alignment will not work. Component must be smaller than parent.

The problem might be that the only component defining the width of the content layout might be your child layout. Check that the parent layout of “content” has some defined width (i.e. not auto/undefined), so that the “content” layout can get it’s 100% width from somewhere.

What version are you using?

Hi Jouni Koivuviita,

I changed the code to setContent(content) instead of addComponent(content) and it works fine with
vaadin 7 beta 1
,
but with
vaadin 7 beta 3
it continues in the same way…
do you know if I have to change all my code to this new version?
and if yes, what can I do to centralize 3 objects together? (like if it was just 1 object)

Thanks James Leotta and Jouni Koivuviita,
Murilo