Ok so that works (calling setHorizontalAlignment() before widgets are 
added). So now the labels are horizontally centered. 

Still can't seem the vertically center them though. I think it's because 
the VerticalPanel keeps wrapping its contents vertically, even though I've 
set its height to 100% (the red area is the VerticalPanel with height=100%):

    http://cl.ly/image/0u0k3c3y1H1X

Any ideas here?

Thanks

On Sunday, 19 August 2012 16:55:01 UTC-4, markww wrote:
>
> Hi,
>
> I'd like to make a vertical group of Buttons, and have them centered 
> horizontally and vertically in the page.
>
> This page will likely be used on mobile devices, so the contents might be 
> taller than the device - so I'll need a scroll bar in those cases:
>
>     http://cl.ly/image/1x3u2A053S01
>
> I'm not sure which set of panels to use for this. A VerticalPanel was my 
> first choice, tried the following:
>   
>     VerticalPanel vp = new VerticalPanel();
>     for (int i = 0; i < 15; i++) {
>         vp.add(new Label("Test " + i));
>     }
>     vp.setWidth("100%");
>     vp.setHeight("100%");
>     vp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
>     vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
>
> but the contents are still top-left aligned (vertical panel 
> background-color is red in this example):
>
>     http://cl.ly/image/2V3p0k3E1h15
>
> There's probably a GWT pattern to do this, any ideas?
>
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/u-l2m4UfhmcJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to