TabLayoutPanel not showing widgets only Tab items

2019-08-13 02:47发布

Simple example of TabLayoutPanel not showing container widgets only Tab items are visible. Something going wrong is it works for IE8

public class DemoGWT implements EntryPoint {
    RootPanel rp = RootPanel.get();

    public void onModuleLoad() {
        TabLayoutPanel panel = new TabLayoutPanel(25, Unit.PX);
        Label a = new Label("One Container");
        panel.add(a, "One Hdr");
        panel.add(new Label("Two Container"), "Two Hdr");
        panel.add(new Label("Three Container"), "Three Hdr");
        panel.add(new Label("Four Container"), "Four Hdr");
        panel.add(new Label("Five Container"), "Five Hdr");
        panel.add(new Label("Six Container"), "Six Hdr");

        rp.add(panel);
    }
}

标签: gwt gwt2
2条回答
对你真心纯属浪费
2楼-- · 2019-08-13 03:04

Don't mix up Layout panels and panels. When you use layout panels such as TabLayoutPanel, Make sure its parent and their parent upto RootPanel are layout panels. Use RootLayoutPanel instead of RootPanel. TabLayoutPanel will not display data unless you mention its absolute height. (Note 100% or any other % won't work). It has to be absolute.

Change the RootPanel to RootLayoutPanel and use setHeight(height) API of your TabLayoutPanel. Don't mention height in %age.

查看更多
狗以群分
3楼-- · 2019-08-13 03:06

I had problems with ie8 with tab client areas not being displayed.

We had created ui XML template panel. Our setup was to display a TabLayoutPanel within a tab of another TabLayoutPanel. The first TabLayoutPanel was entirely visible, the child TabLayoutPanel was invisible but not 'hidden'.

BTW this problem didn't exhibit itself under Firefox!!!!!

Making all panels children of ResizeComposite and ultimately children of root layout panel made no difference. However I kept that mod as it seemed to be the correct GWT way of coding layout panels.

The problems solution as it turned out was quite surprising and unexpected.

I had specified sizes of composite panels in EM units. When I switched the child TabLayoutPanel to PX units and it's tab children panels to PX units everything displayed OK.

查看更多
登录 后发表回答