简体   繁体   English

GWT在现有小部件上方添加小部件

[英]GWT add a widget above the existing widget

I have a VericalPanel . 我有一个VericalPanel If I add an element to it, it will be added under the element, now how can I place an Element over it? 如果我向其添加元素,则该元素将添加到该元素下方,现在如何在其上放置元素?

VerticapPanel vpanel  = new VerticalPanel()

You can use 您可以使用

VerticalPanel#insert(Widget w, int beforeIndex)

instead of 代替

VerticalPanel#add(Widget w)

This will insert the widget at the given position. 这将在指定位置插入小部件。

Try the insert method: 尝试insert方法:

Here the description of the method regarding the documentation 这里是关于文档的方法描述

protected void insert(Widget child, Element container, int beforeIndex, boolean domInsert)

Insert a new child Widget into this Panel at a specified index, attaching its Element to the specified container Element. 在指定的索引处将一个新的子Widget插入此面板,并将其Element附加到指定的容器Element。 The child Element will either be attached to the container at the same index, or simply appended to the container, depending on the value of domInsert. 根据domInsert的值,子元素将以相同的索引附加到容器,或者简单地附加到容器。

Parameters: 参数:
child - the child Widget to be added child -孩子的Widget添加
container - the Element within which child will be contained container将包含子元素的元素
beforeIndex - the index before which child will be inserted beforeIndex将在其之前插入子项的索引
domInsert - if true , insert child into container at beforeIndex ; domInsert如果为true ,则在beforeIndex处将child插入容器; otherwise append child to the end of container. 否则将child附加到容器的末尾。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM