GWT 异常:SimplePanel 只能包含一个子部件

GWT Exception: SimplePanel can only contain one child widget

以下ui.xml文件输出抛出异常

<g:HTMLPanel ui:field="uiPanelDialog" styleName="{CSS.common.flexContainerColumn} {style.content}">
    <g:Label ui:field="uiLabelTitle" styleName="{style.title}" text="What are you Looking for?"/>
    <g:HTMLPanel ui:field="uiPanelOptions" styleName="{style.scroll}">
        <g:FocusPanel ui:field="uiPanelWelcomeTutorial" styleName="{style.options}">
            <g:Image styleName="{style.image}" url="res/images/user_b.png" width="60px" height="60px" />
            <g:Label>Welcome Tutorial</g:Label>
        </g:FocusPanel>
        <g:FocusPanel ui:field="uiPanelGettingStarted" styleName="{style.options}">
            <g:Image styleName="{style.image}" url="res/images/user_b.png" width="60px" height="60px" />
            <g:Label>Getting Started</g:Label>
        </g:FocusPanel>
        <g:FocusPanel ui:field="uiPanelAppointmentManagement" styleName="{style.options}">
            <g:Image styleName="{style.image}" url="res/images/user_b.png" width="60px" height="60px" />
            <g:Label>Appointment Management</g:Label>
        </g:FocusPanel>
        <g:FocusPanel ui:field="uiPanelClientMangement" styleName="{style.options}">
            <g:Image styleName="{style.image}" url="res/images/user_b.png" width="60px" height="60px" />
            <g:Label>Client Mangement</g:Label>
        </g:FocusPanel>
        <g:FocusPanel ui:field="uiPanelStaffManagement" styleName="{style.options}">
            <g:Image styleName="{style.image}" url="res/images/user_b.png" width="60px" height="60px" />
            <g:Label>Staff Management</g:Label>
        </g:FocusPanel>
        <g:FocusPanel ui:field="uiPanelIntegrationSetup" styleName="{style.options}">
            <g:Image styleName="{style.image}" url="res/images/user_b.png" width="60px" height="60px" />
            <g:Label>Integration Setup</g:Label>
        </g:FocusPanel>
        <g:FocusPanel ui:field="uiPanelTechnicalSetup" styleName="{style.options}">
            <g:Image styleName="{style.image}" url="res/images/user_b.png" width="60px" height="60px" />
            <g:Label>Technical Setup</g:Label>
        </g:FocusPanel>
    </g:HTMLPanel>
    <g:HTMLPanel ui:field="uiPanelFooter">
        <g:FocusPanel ui:field="uiPanelGetHelpOnline" styleName="{style.options}" width="50%">
            <g:Label>Get Help Online</g:Label>
        </g:FocusPanel>
        <div class="{style.option-divider}" />
        <g:FocusPanel ui:field="uiPanelSendFeedback" styleName="{style.options}" width="50%">
            <g:Label>Send Feedback</g:Label>
        </g:FocusPanel>
    </g:HTMLPanel>

</g:HTMLPanel>

Caused by: java.lang.IllegalStateException: SimplePanel can only contain one child widget

我不明白为什么会这样 exception.What 是上面代码中的问题。我想了解如何将不同的部分放在焦点面板中。

   <g:FocusPanel ui:field="uiPanelWelcomeTutorial" styleName="{style.options}">
       <g:Image styleName="{style.image}" url="res/images/user_b.png" width="60px" height="60px" />
       <g:Label>Welcome Tutorial</g:Label>
   </g:FocusPanel>

FocusPanel extends SimplePanel,它只能有一个 child,正如你的错误告诉你的那样。我不确定您为什么要使用 FocusPanel 来包裹这两个 children,但是您不能这样做 - 只允许其中一个 child。如果您出于某种原因希望它们可以集中在一起,请将 ImageLabel 放在一个容器中,然后将 that 放入 FocusPanel .