Creating a fluid panel in GWT to fill the page?

前端 未结 8 2022
不思量自难忘°
不思量自难忘° 2021-02-05 09:53

I would like a panel in GWT to fill the page without actually having to set the size. Is there a way to do this? Currently I have the following:

public class M         


        
相关标签:
8条回答
  • 2021-02-05 10:33

    Ben's answer is very good, but is also out of date. A resize handler was necessary in GWT 1.6, but we are at 2.4 now. You can use a DockLayoutPanel to have your content fill the page vertically. See the sample mail app, which uses this panel.

    0 讨论(0)
  • 2021-02-05 10:34

    For me it does not work if I just set the width like

    panel.setWidth("100%");

    The panel is a VerticalPanel that it just got a randomly size that I don't know where it comes from. But what @Ben Bederson commented worked very well for me after I added the line:

    panel.setWidth(Window.getClientWidth() + "px");

    Just this, nothing else. Thanks

    0 讨论(0)
提交回复
热议问题