通常,滚动面板只有一列。如果我想要两列,我该如何修改我的代码?
ScrollPanel scrollPanel =new ScrollPanel(panel1);
scrollPanel.setSize("200px","100px");
DecoratorPanel decoratorPanel =new DecoratorPanel();
decoratorPanel.add(scrollPanel);
RootPanel.get("gwtContainer").add(panel);
RootPanel.get("gwtContainer").add(decoratorPanel);
答案 0 :(得分:0)
您可以滚动网格,FlexTable或LayoutPanel,这样您就可以使用通用滚动条来进行灵活布局。
LayoutPanel lp = new LayoutPanel();
lp.add(whatever1);
lp.add(whatever2);
lp.setWidgetLeftWidth(whatever1, 0, Unit.PCT, 50, Unit.PCT);
lp.setWidgetRightWidth(whatever2, 0, Unit.PCT, 50, Unit.PCT);
ScrollPanel scrollPanel = new ScrollPanel(lp);
scrollPanel.setSize("200px", "100px");
DecoratorPanel decoratorPanel = new DecoratorPanel();
decoratorPanel.add(scrollPanel);
RootPanel.get("gwtContainer").add(decoratorPanel);
希望有所帮助