GWT:如何创建带有水平滚动条的TabsLayoutPanel?
我正在使用GWT2.4。我正在尝试创建一个选项卡面板,它有多个选项卡,很多选项卡有时会超出分配的水平边界。如何显示水平滚动条?下面是我如何创建我的标签面板现在GWT:如何创建带有水平滚动条的TabsLayoutPanel?,gwt,Gwt,我正在使用GWT2.4。我正在尝试创建一个选项卡面板,它有多个选项卡,很多选项卡有时会超出分配的水平边界。如何显示水平滚动条?下面是我如何创建我的标签面板现在 tabsPanel = new TabLayoutPanel(BAR_HEIGHT_IN_EM, Style.Unit.EM); final List<ScrollPanel> tabs = new ArrayList<ScrollPanel>(); for (fi
tabsPanel = new TabLayoutPanel(BAR_HEIGHT_IN_EM, Style.Unit.EM);
final List<ScrollPanel> tabs = new ArrayList<ScrollPanel>();
for (final Node tabNode : documentNode.getChildren()) {
// Get the tab's child widgets and add them
// into the tab panel.
final ScrollPanel childpanel = new ScrollPanel();
childpanel.setHeight(SCROLL_PANEL_HEIGHT_PCT);
...
tabsPanel.add(childpanel, tabName);
} // for
tabsPanel.setWidth("100%");
tabsPanel.setHeight("100%");
如您所见,我尝试了宽度=100%,但没有出现允许我查看多余选项卡的滚动面板
谢谢,-Dave使用TabLayoutPanel没有内置的方法来实现这一点,但是查看它的代码,可以做到这一点:
SimplePanel tab = (SimplePanel) getTabWidget(0).getParent();
FlowPanel tabBar = (FlowPanel) tab.getParent();
LayoutPanel container = (LayoutPanel) tabBar.getParent();
Element tabBarContainerLayer = container.getWidgetContainerElement(tabBar);
tabBarContainerLayer.getStyle().clearOverflowX();
免责声明:未经测试