我想知道是否有可能获得在GWT一个GWT ScrollPanel让孩子们的最大尺寸不滚动
com.google.gwt.user.client.ui.ScrollPanel
对象的内部尺寸?我想创建一个ScrollPanel的孩子,它完全符合空的空间,而不用激活滚动条。
public void onModuleLoad() {
Window.setMargin("0px");
TabLayoutPanel tabs = new TabLayoutPanel(30, Unit.PX);
//attach the tab panel to the body element
RootPanel.get(null).add(tabs);
//set the TabLayoutPanel to full size of the window.
String width = (Window.getClientWidth()) + "px";
String height = (Window.getClientHeight()) + "px";
tabs.setSize(width, height);
//create the scroll panel and activate the scroll bars
ScrollPanel scrollPanel = new ScrollPanel(new Button("a second button"));
scrollPanel.getElement().getStyle().setOverflowX(Overflow.SCROLL);
scrollPanel.getElement().getStyle().setOverflowY(Overflow.SCROLL);
//attach the scroll panel to the DOM
tabs.add(scrollPanel, "tab1");
System.out.println(scrollPanel.getOffsetWidth()); // --> 0
System.out.println(scrollPanel.getOffsetHeight()); // --> 0
}
[结束更新]
原因[@Abhijith纳加拉贾的答案之后开始更新]:我想初始化一个动态可视化(这需要滚动条 的ScrollPanel如下初始化在稍后的时间点),这样看起来不错,并且避免在稍后添加ScrollPanel。
首先是滚动面板是从简单的面板上,所以只有一个孩子可以添加,旁边填补空白需要增加儿童的体形准确地滚动面板尺寸。希望这是你正在寻找的,如果不是,请更多地解释它.. – Dipak 2013-03-16 04:49:27