How can I vertically center an element with GWT?

Posted by Camille on Stack Overflow See other posts from Stack Overflow or by Camille
Published on 2010-03-24T19:10:59Z Indexed on 2010/03/24 19:13 UTC
Read the original article Hit count: 290

Filed under:
|
|

Perhaps I haven't been searching the right way but I cannot figure out for the life of me how to center an element using GWT Layout Panels.

I'm using UiBinder and I've tried all panels that implement HasVerticalAlignment (DockPanel, HorizontalPanel, VerticalPanel). None of them seem to have any impact from setting vertical alignment (or even horizontal). I've made sure they're taking 100% width and height, inspected the resulting DOM layout from my browser and nothing seems to be changed from those properties.

The quick and dirty fix I've figured out is to create my own "CenterPanel" widget which basically is a wrapper around a HTMLPanel with a HTML table with a valign="middle" cell. However, this basically feels like a throwback to the classical css-layout middle centering problems. Surely GWT has something to do this that I've completely overlooked?

© Stack Overflow or respective owner

Related posts about gwt

Related posts about layout