在GWT中创建一个流体面板来填充页面? [英] Creating a fluid panel in GWT to fill the page?

查看:172
本文介绍了在GWT中创建一个流体面板来填充页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要GWT中的一个面板填充页面,而不必实际设置大小。有没有办法做到这一点?目前我有以下几种:

$ $ $ $ pre $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ public void onModuleLoad()
{
Horizo​​ntalSplitPanel split = new Horizo​​ntalSplitPanel();
//split.setSize(\"250px,500px);
split.setSplitPosition(30%);

DecoratorPanel dp = new DecoratorPanel();
dp.setWidget(split);

RootPanel.get()。add(dp);
}

}

使用前面的代码片断,出现。有没有方法调用我缺少?



谢谢。






更新08年9月17日在20:15



我在每边放一些按钮(明确设置它们的大小)没有工作。我真的很惊讶没有像FillLayout类或setFillLayout方法或setDockStyle(DockStyle.Fill)或类似的东西。也许这是不可能的?但是,像GWT一样受欢迎,我认为这将是可能的。



更新08年9月18日在14:38



我已经尝试将RootPanel的宽度和高度设置为100%,但仍然无法工作。感谢您的建议,但似乎它可能会起作用。任何其他建议??

解决方案

Google在其常见问题解答中回答了您问题的主要部分:
< a href =http://code.google.com/webtoolkit/doc/1.6/FAQ_UI.html#How_do_I_create_an_app_that_fills_the_page_vertically_when_the_b =nofollow noreferrer> http://code.google.com/webtoolkit/doc/1.6/FAQ_UI .html#How_do_I_create_an_app_that_fills_the_page_vertically_when_the_b



主要观点是您无法将高度设置为100%,您必须执行以下操作:

  final VerticalPanel vp = new VerticalPanel(); 
vp.add(mainPanel);
vp.setWidth(100%);
vp.setHeight(Window.getClientHeight()+px);
Window.addResizeHandler(new ResizeHandler(){

public void onResize(ResizeEvent event){
int height = event.getHeight();
vp.setHeight(高度+px);
}
});
RootPanel.get()。add(vp);


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 Main  implements EntryPoint
{
    public void onModuleLoad()
    {
        HorizontalSplitPanel split = new HorizontalSplitPanel();
        //split.setSize("250px", "500px");
        split.setSplitPosition("30%");

        DecoratorPanel dp = new DecoratorPanel();
        dp.setWidget(split);

        RootPanel.get().add(dp);
    }

}

With the previous code snippet, nothing shows up. Is there a method call I am missing?

Thanks.


UPDATE Sep 17 '08 at 20:15

I put some buttons (explicitly set their size) on each side and that still doesn't work. I'm really surprised there isn't like a FillLayout class or a setFillLayout method or setDockStyle(DockStyle.Fill) or something like that. Maybe it's not possible? But for as popular as GWT is, I would think it would be possible.

UPDATE Sep 18 '08 at 14:38

I have tried setting the RootPanel width and height to 100% and that still didn't work. Thanks for the suggestion though, that seemed like it maybe was going to work. Any other suggestions??

解决方案

Google has answered the main part of your question in one of their FAQs: http://code.google.com/webtoolkit/doc/1.6/FAQ_UI.html#How_do_I_create_an_app_that_fills_the_page_vertically_when_the_b

The primary point is that you can't set height to 100%, you must do something like this:

final VerticalPanel vp = new VerticalPanel();
vp.add(mainPanel);
vp.setWidth("100%");
vp.setHeight(Window.getClientHeight() + "px");
Window.addResizeHandler(new ResizeHandler() {

  public void onResize(ResizeEvent event) {
    int height = event.getHeight();
    vp.setHeight(height + "px");
  }
});
RootPanel.get().add(vp);

这篇关于在GWT中创建一个流体面板来填充页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆