PDA

View Full Version : How to position my page in the center of the browser



msauter
10 Jul 2009, 4:32 AM
Is it possible to position my GWT-page in the center (horizontal and vertical) of the browser, using EXT or GWT-functions? I am only adding my own Widget to the RootPanel, so i think changes should be made there?



public void onModuleLoad() {

MyComplexLayout complex = new MyComplexLayout();
RootPanel.get().add(complex);


Thanks for help! :)

sven
10 Jul 2009, 4:35 AM
You can use a Viewport with a CenterLayout for that

msauter
10 Jul 2009, 5:01 AM
Great idea, thanks it is working!



MyComplexLayout complex = new MyComplexLayout();
Viewport vp = new Viewport();
CenterLayout cl = new CenterLayout();
vp.setLayout(cl);
vp.add(complex);
RootPanel.get().add(vp);