you should to adjust the order,like this:
    VerticalPanel vp = new VerticalPanel();
    vp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    for (int i = 0; i < 15; i++) {
        vp.add(new Label("Test " + i));
    }
    vp.setWidth("100%");
    vp.setHeight("100%");




2012/8/20 Dennis Haupt <[email protected]>

> >     vp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
> >     vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
>
> this alignes the panel itself, not the content.
> if you want to do fancy layout stuff, use a flextable:
>
> table.getFlexCellFormatter().set...Alignment(x,y,...)
>
> Am 19.08.2012 22:55, schrieb markww:
> > 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/-/IaS1mJU90FQJ.
> > 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.
>
>
> --
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> 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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
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