[英]GWT AbsolutePanel not shown in browser
I create widget containing AbsolutePanel using GWT UiBinder like this: 我使用GWT UiBinder创建包含AbsolutePanel的小部件,如下所示:
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<g:VerticalPanel>
<g:Label>Label1</g:Label>
<g:AbsolutePanel height="500" width="500">
<g:at left='10' top='60'>
<g:Label>Label2</g:Label>
</g:at>
<g:at left='10' top='100'>
<g:Label>Label3</g:Label>
</g:at>
</g:AbsolutePanel>
<g:Label>Label4</g:Label>
</g:VerticalPanel>
</ui:UiBinder>
Than create corresponding class : 比创建对应的类:
public class TestAbsPanelWidget extends Composite {
@UiTemplate("TestAbsPanelWidget.ui.xml")
interface MyUiBinder extends UiBinder<Widget, TestAbsPanelWidget> {}
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
public TestAbsPanelWidget() {
initWidget(uiBinder.createAndBindUi(this));
}
}
Than use it my GWT entry point like this: 比起我的GWT入口点,使用它像这样:
public class TestAbsPanel2 implements EntryPoint {
public void onModuleLoad() {
RootPanel.get("div_id").add(new TestAbsPanelWidget());
}
}
After that I see "Label1" and "Label4" on screen in browser, but no "Label2" and "Label3". 之后,我在浏览器的屏幕上看到“ Label1”和“ Label4”,但是没有“ Label2”和“ Label3”。 It seems that AbsolutePanel not shown.
似乎没有显示AbsolutePanel。 What am I doing wrong help me please.
我做错了什么请帮助我。
You try to set the panel's width and height with: 您尝试使用以下方法设置面板的宽度和高度:
<g:AbsolutePanel height="500" width="500">
but you don't specify CSS units. 但您未指定CSS单位。 Try:
尝试:
<g:AbsolutePanel height="500px" width="500px">
and you will see Label2
and Label3
. 然后您将看到
Label2
和Label3
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.